Вот мой сценарий, который в основном рассчитывает количество строк, затем добавляет, а затем подсчитывает их снова, чтобы у вас были доказательства, что это сработало.
shortPath = "../file_to_be_appended"
short = open(shortPath, 'r')
## this counts how many line are originally in the file:
long_path = "../file_to_be_appended_to"
long = open(long_path, 'r')
for i,l in enumerate(long):
pass
print "%s has %i lines initially" %(long_path,i)
long.close()
long = open(long_path, 'a') ## now open long file to append
l = True ## will be a line
c = 0 ## count the number of lines you write
while l:
try:
l = short.next() ## when you run out of lines, this breaks and the except statement is run
c += 1
long.write(l)
except:
l = None
long.close()
print "Done!, wrote %s lines" %c
## finally, count how many lines are left.
long = open(long_path, 'r')
for i,l in enumerate(long):
pass
print "%s has %i lines after appending new lines" %(long_path, i)
long.close()
Ваш объект TypoScript будет выглядеть следующим образом
mycustompageType = PAGE
mycustompageType{
typeNum = 1897
config {
#Required configuration
}
10 = USER_INT
10{
vendorName = YourVendorName
userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
extensionName = YourExtensionName
pluginName = YourPluginName
controller = YourController
switchableControllerActions {
YourController {
1 = YourAction
}
}
}
}
Подробные сведения о расширении можно получить с помощью приведенного ниже кода // получить информацию о расширении
echo $this->request->getControllerExtensionName()."<br>";
echo $this->request->getPluginName()."<br>";
echo $this->request->getControllerName()."<br>";
Наконец, вам нужно запустить этот URL " yourdomain.com/?type=1897"
Наслаждайтесь !!
Привет и добро пожаловать в StackOverflow.
Я недавно обрабатывал такую функцию и сделал это следующим образом:
data
)