[Neos] How to select different page templates
Nick
nick at jamalade.com
Tue Sep 10 01:15:47 CEST 2013
I thought I was making pretty good progress on this :
On Mattias suggestion I created the a NodeTypes.yamlfile in
mySite/Configuration to add a new property to TYPO3.Neos.Page with the
following:
## YAML Template.
# add a field to the page properties
'TYPO3.Neos:Page':
superTypes: ['TYPO3.Neos:Document']
ui:
inspector:
groups:
pageLayout:
label: 'Page Layout Info'
properties:
layoutType:
type: string
ui:
label: 'layoutType'
reloadIfChanged: TRUE
inspector:
group: 'pageLayout'
This worked a dream and the option appeared in the Neos Inspector window.
For Step 2 I tried adding the following to the Roots.ts2 file in
mySites (Resources/Private...) to use the new property to select the
appropriate Fluid template:
page.body{
...
layoutType = ${q(node).property('layoutType')}
templatePath = ${layoutType !='home' ?
'resource://reroot.DemoSiteReroot/Private/Templates/Page/Default.html':
'resource://reroot.DemoSiteReroot/Private/Templates/Page/Home.html'}
...
}
Now adding this into the Roots.ts2 at first threw an exception then when
trying to work out what I got wrong and after a couple of reload
attempts whilst logged into the back end(first getting an exception
thrown) I ended up whith a white screen not my test website! This is now
the case when I either just connect to the site (after flushing flow
cache and shutting down apache) or after logging in to backend!
I am left with two questions: First what did I do wrong? Second is it
possible to recover the site in such a white out?
Many thanks
Nick
On 08/09/2013 15:56, Nick wrote:
> Hi Mattias,
>
> Thanks for your reply, this would be a really useful feature for the
> release.
>
> I also would really appreciate a bit more help with trying to implement
> this as I am not quite sure how I would achieve this, I am still trying
> to get an understanding of how things work with Neos.
>
> Your help would be appreciated
>
> Nick
>
>
>
>
> On 08/09/2013 14:39, Mattias Nilsson wrote:
>> Hi Nick,
>>
>> There is currently no possibility to change a page template in the UI.
>> But
>> this is something is going to be implemented before the release of
>> version
>> 1.0.
>>
>> You can also make your own page template selector by defining an extra
>> property for TYPO3.Neos:Page inside YAML. Then you can use this
>> property to
>> assign the chosen value to which page template it should match using
>> TypoScript.
>>
>> If you need more help let me know and I will make a more detail
>> version for
>> you :)
>>
>> /Mattias
>>
>>
>> On Sat, Sep 7, 2013 at 4:05 PM, Nick <nick at jamalade.com> wrote:
>>
>>> Hi
>>>
>>> I am a neewbie to using Neos, so please forgive me for my questions, but
>>> have been following its progress from afar for a while now.
>>> I have been thinking/toying with the idea of using Neos for a new
>>> project.
>>> With that in mind I have been playing around with the demo site as per
>>> release alpha 5.
>>>
>>> First up I am a little confused as to how to get the homepage to
>>> display a
>>> different view (fluid template) from another page on a site.
>>>
>>> I can see in the NeosDemoTypo3Org site that there are a couple of
>>> typoscript files one for the homepage and a default one one for the
>>> rest of
>>> the site:
>>>
>>>
>>> ~/TYPO3-Neos-1.0-alpha5/Packages/Sites/TYPO3.NeosDemoTypo3Org/Resources/Private/TypoScripts/Nodes/Homepage/Home.ts2
>>>
>>> this defines the page.body.templatePath =
>>> 'resource://TYPO3.NeosDemoTypo3Org/Private/Templates/Page/Home.html
>>>
>>> Looking at the fluid template pointed to here, I can see that on the
>>> home
>>> page the "teaser" content should be displayed above the "main" content
>>>
>>> The default can be found in :
>>>
>>> ~/TYPO3-Neos-1.0-alpha5/Packages/Sites/TYPO3.NeosDemoTypo3Org/Resources/Private/TypoScripts/Library/Root.ts2
>>>
>>> this defines the page.body.templatePath =
>>> 'resource://TYPO3.NeosDemoTypo3Org/Private/Templates/Page/Default.html
>>>
>>> In this fluid template the teaser isn't rendered.
>>>
>>>
>>> However when I actually go to the home page i.e. http://neos.demo/ I can
>>> see that the Default.html is rendered not the Home.html fluid template.
>>>
>>> I am wondering how then you actually select the Home.html template
>>> for the
>>> home page, if not with the typoscript files as above?
>>>
>>> This would be an essential feature for me as for the project I am
>>> working
>>> on there are several different page templates required for different
>>> parts
>>> of the site.
>>>
>>> Many thanks in advance
>>>
>>> Nikos
>>> _______________________________________________
>>> Neos mailing list
>>> Neos at lists.typo3.org
>>> http://lists.typo3.org/cgi-bin/mailman/listinfo/neos
>>>
>
More information about the Neos
mailing list