i already got one Ajax action on my controller, now i want to create more other Ajax Actions. I have tried to modify the setup.txt but have no luck. My setup.txt:
ajax = PAGE
ajax {
typeNum = 99
config {
disableAllHeaderCode = 1
additionalHeaders = Content-type:application/json
admPanel = 0
debug = 0
}
10<lib.silver
}
ajax1 = PAGE
ajax1 {
typeNum = 100
config {
disableAllHeaderCode = 1
additionalHeaders = Content-type:application/json
admPanel = 0
debug = 0
}
10<lib.silver
}
My first Ajax with typeNum = 99 work but typeNum = 100 does not work.
Maybe you come in conflict with other extensions which use the given pageType.
Especially the values of 100 and below are used quite often.
for example: ext:directmail uses 99 for text-rendering and 100 for html-rendering of the newsletters.
your definition might get confused with user page-definitions for the same typeNum. try some 'random' numbers.
Related
I tried this, in my extension's setup.typoscript. but is not work for me.
plugin.tx_blog {
view {
layoutRootPaths = EXT:solution/Resources/Private/Extensions/Blog/Layouts/
partialRootPaths = EXT:solution/Resources/Private/Extensions/Blog/Partials/
templateRootPaths = EXT:solution/Resources/Private/Extensions/Blog/Templates/
}
}
all the "RootPaths" are arrays so change it to somting like this
plugin.tx_blog {
view {
layoutRootPaths.200 = EXT:solution/Resources/Private/Extensions/Blog/Layouts/
partialRootPaths.200 = EXT:solution/Resources/Private/Extensions/Blog/Partials/
templateRootPaths.200 = EXT:solution/Resources/Private/Extensions/Blog/Templates/
}
the "200" in the examle is the position if Fluid is looking for a Resource (like a template) it will check every provided path in numerical order.
use the Typoscript Object Browser (in the Template Module) to check the configured RootPaths
The standard setup of that extension is a bit uncommon.
The easiest was to override the paths for fluid files is to use the constant editor. There you have fields where you can enter your own paths.
If you want to do it in the setup, you can look in the TypoScript setup of the extension that looks like shown below.
page = PAGE
page {
typeNum = 0
10 = FLUIDTEMPLATE
10 {
templateName = BlogList
templateRootPaths {
0 = EXT:blog/Resources/Private/Templates/Page/
1 = {$page.fluidtemplate.templateRootPath}
}
partialRootPaths {
0 = EXT:blog/Resources/Private/Partials/Page/
1 = {$page.fluidtemplate.partialRootPath}
}
layoutRootPaths {
0 = EXT:blog/Resources/Private/Layouts/Page/
1 = {$page.fluidtemplate.layoutRootPath}
}
...
So in a short block the the paths would look like this:
page.10.templateRootPaths {
0 = EXT:blog/Resources/Private/Templates/Page/
1 = {$page.fluidtemplate.templateRootPath}
}
page.10.partialRootPaths {
0 = EXT:blog/Resources/Private/Partials/Page/
1 = {$page.fluidtemplate.partialRootPath}
}
page.10.layoutRootPaths {
0 = EXT:blog/Resources/Private/Layouts/Page/
1 = {$page.fluidtemplate.layoutRootPath}
}
In the lines starting with 1 you can enter your own path if you never want to use the constants. For this you never have to enter it in the original TypoScript template, but just copy the block above in your own TypoScript and adjust the paths. If your TypoScript is loaded after that of the blog, it's overwriting the original values.
Take care that there exist different setups, one in each folder inside https://github.com/TYPO3GmbH/blog/tree/master/Configuration/TypoScript. So depending on the template you chose the setup must be different. But I hope you're able to adapt the way to go now.
I'm trying to create a routeEnhancer for a simple GET parameter:
/?pageNumber=1&cHash=...
This parameter (including the cHash) is generated by the page browser of a multi-page sitemap (pure TypoScript), which can be simulated with the following simplified TypoScript:
page.10 = COA
page.10{
10 = LOAD_REGISTER
10{
pageNumber.cObject = TEXT
pageNumber.cObject.value = 0
pageNumber.cObject.override.data= GP:pageNumber
pageNumber.cObject.wrap = (|+1)
pageNumber.prioriCalc = intval
}
20 = TEXT
20{
data = register:pageNumber
typolink {
parameter.data = TSFE:id
additionalParams.data = register:pageNumber
additionalParams.wrap = &pageNumber=|
}
}
}
Result (without routeEnhancers):
On page 0 (the root page "/"): 1
On page 1: 2
On page 2: 3
And so on. That works as expected, but I'd like to have nicer URLs.
My routeEnhancers attempt for rewriting the URLs:
routeEnhancers:
PageBrowser:
type: Simple
routePath: '/page/{page_number}'
requirements:
page_number: '[0-9]'
_arguments:
page_number: 'pageNumber'
Result with this routeEnhancer:
On page 0: 1
On page 1 the link unfortunately remains unchanged: 1
It seems that the encoding works, but the decoding fails.
What am I doing wrong?
It looks there is some confusion with page_number and pageNumber:
I think this setup does, what you are looking for. (I had to manually delete cache too)
page = PAGE
page.10 = COA
page.10{
10 = LOAD_REGISTER
10{
pageNumber.cObject = TEXT
pageNumber.cObject.value = 0
pageNumber.cObject.override.data= GP:pageNumber
pageNumber.cObject.wrap = (|+1)
pageNumber.prioriCalc = intval
}
20 = TEXT
20{
data = register:pageNumber
typolink {
parameter.data = TSFE:id
additionalParams.data = register:pageNumber
additionalParams.wrap = &pageNumber=|
}
}
}
routeEnhancers:
PageBrowser:
type: Simple
routePath: '/page/{pageNumber}'
requirements:
pageNumber: '[0-9]+'
I want to make a link from a template to a pageType, made for iCal download:
<f:link.action pageType="730" arguments="{event: event}" target="_blank" title="bla">iCal Download</f:link.action>
In typoscript
tx_myext_icalendar = PAGE
tx_myext_icalendar {
typeNum = 730
config {
disableAllHeaderCode = 1
xhtml_cleaning = none
admPanel = 0
metaCharset = utf-8
additionalHeaders = Content-Type:text/calendar;charset=utf-8
disablePrefixComment = 1
}
10 = USER
10 {
userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
vendorName = Me
extensionName = SiteMe
pluginName = Events
switchableControllerActions {
Icalevent {
1 = iCalendar
}
}
}
}
In my iCalendarAction in the IcalleventController I never receive the arguments. No matter what I type there, not by parameter, neither by $this->request->getArguments()
I guess I need to adjust the typoscript. Any help would be welcome.
Thanks for your comments. Indeed the extensionname, pluginname, action, controller were needed in the link.action.
The thing is that the config extension which holds this, uses a custom extension that defines things like custom content elements. (I did not create this, so I got confused by it). Therefore the generated link was not the same (for extensionname, pluginname, action and controller) as defined in the pagetype. By explicitly defining them in the html template (link action), any argument is now received in the ical template.
I use TYPO3 7.6.10 and sitemap_generator 1.0
I see the sitemap.xml and it generates the map but there are not the categories and tags like "categoy/nameofcategory".
How can I solve it?
The code in template is:
plugin.tx_sitemapgenerator {
urlEntries {
pages = 1
pages {
rootPageId = 1
allowedDoktypes = 1
additionalWhere = doktype!=6
}
}
}
plugin.tx_sitemapgenerator {
urlEntries {
news = 1
news {
active = 1
table = tx_news_domain_model_news
additionalWhere = pid!=0
orderBy = title DESC
limit = 0,1000
lastmod = tstamp
url = TEXT
url {
typolink.parameter = 161
typolink.additionalParams = &tx_news_pi1[controller]=News&tx_news_pi1[action]=detail&tx_news_pi1[news]={field:uid}
typolink.additionalParams.insertData = 1
typolink.useCacheHash = 1
typolink.returnLast = url
typolink.forceAbsoluteUrl = 1
}
}
}
}
A sitemap for google doesn't contain such stuff as tags and description, so there is no need for the extension to deliver that stuff. Check the specs of creating a sitemap here. Google build a sitemap
I have the following config
page = PAGE
page {
typeNum = 0
10 = FLUIDTEMPLATE
10 {
templateRootPath = EXT:folder/Resources/Private/Website/Templates/
partialRootPath = EXT:folder/Resources/Private/Website/Partials/
layoutRootPath = EXT:folder/Resources/Private/Website/Layout/
file.stdWrap.cObject = CASE
file.stdWrap.cObject {
key.data = levelfield:-1, backend_layout_next_level, slide
key.override.field = backend_layout
default = TEXT
default.value = whatever.html
1 < .default
2 = TEXT
2.value = whatever-else.html
}
}
Somehow the 'backend_layout_next_level' is not working; it is not sliding down the tree. As a result I have to set a backend_layout for each page which is not what one should expect.
Is there a way of knowing/debugging/finding out what's causing this? I thought it might be something related to a curly brace being in the wrong place (too early, too late or just plain wrong) inside my typoscript. Therefor I looked inside the Typoscript Template Analyzer and found some errors which I've fixed, but the problem still persists.
Thanks already!
Best regards
You use have to give the full path to the file as a value in the .file property or you should use .templateName instead and only provide the name (case sensitive!!!) of the template file without suffix.
#see https://docs.typo3.org/typo3cms/TyposcriptReference/ContentObjects/Fluidtemplate/Index.html
Note that in your current setting, the uid of the template record must be 1 or 2.
And you can try to use levelfield: -2 instead of levelfield: -1.
TBH I never understood this #^$#% CASE syntax... Therefore definitely prefer common condition which works perfect, you must to add custom condition like I showed in other post, so you can use it like:
page {
typeNum = 0
10 = FLUIDTEMPLATE
10 {
templateRootPath = EXT:folder/Resources/Private/Website/Templates/
partialRootPath = EXT:folder/Resources/Private/Website/Partials/
layoutRootPath = EXT:folder/Resources/Private/Website/Layout/
file = whatever.html
}
}
[userFunc = user_beLayout(2)]
page.10.file = whatever-else.html
[userFunc = user_beLayout(3)]
page.10.file = yet-other.html
[userFunc = user_beLayout(4)]
page.10.file = etc.html
[end]
Edit - to satisfy some comments
Note: When I say that I don't understand CASE syntax, that doesn't mean that I don't know it... especially that I studied it in details not once, here's the conclusion...
About performance:
Custom conditions solution is faster than using CASE and slide combination as it doesn't involve additional DB queries (slide does), it iterates $GLOBALS['TSFE']->page array, which is already collected, and stops further checks ASAP, so it's cheaper than slide which makes additional queries if it finds slide in TS (doesn't matter if it's required or not) - (examine the code for slide mechanics), so actually conditions are performance-saver not killer :)
Yet more
Using conditions blocks you can change behavior of multiple elements at once (instead writing separate CASE for each) i.e.:
[userFunc = user_beLayout(2)]
page.10.file = whatever-else.html
lib.genericMenu >
config.absRefPrefix = /layout-specific-abs/
// etc...
[end]
Using CASE syntax you'll need to repeat all these checks for each element... (where's DRY?)
Finally
Both solutions are ... usable especially when using with cached pages, (difference between them will be about teens or maybe in drastic situation hundred milliseconds -conditions will be faster), for uncached pages most probably it will be good idea to set be_layout directly for each pages record in both cases.
It is quite some time ago, you probably resolved your issue but here is a working approach:
page = PAGE
page {
10 = FLUIDTEMPLATE
10 {
# select different html files for layouts - ref: backend_layout
file.stdWrap.cObject = TEXT
file.stdWrap.cObject {
data = levelfield:-2,backend_layout_next_level,slide
override.field = backend_layout
split {
token = pagets__
1.current = 1
1.wrap = |
}
wrap = EXT:folder/Resources/Private/Templates/|.html
}
layoutRootPath = EXT:folder/Resources/Private/Layouts/
partialRootPath = EXT:folder/Resources/Private/Partials/
}
}
or you can pass it as a variable:
page = PAGE
page {
10 = FLUIDTEMPLATE
10 {
file = EXT:folder/Resources/Private/Templates/Main.html
layoutRootPath = EXT:folder/Resources/Private/Layouts/
partialRootPath = EXT:folder/Resources/Private/Partials/
variables {
# BE_Layout
BE_Layout = COA
BE_Layout {
stdWrap.cObject = TEXT
stdWrap.cObject {
data = levelfield:-2,backend_layout_next_level,slide
override.field = backend_layout
split {
token = pagets__
1.current = 1
1.wrap = |
}
wrap = |.html
}
}
}
}