[Typo3] Using TSconfig to change colPos_list based on page layout

Joseph Mesterhazy jmesterh at iastate.edu
Fri Jun 24 20:53:04 CEST 2005

Fair enough, here is what I am doing, and the result I would like.

I have two modern template, css-styled-content using the template  
autoparser templates. A three-column (normal layout) and a two-column  
(layout 1). My template tssetup feeds the appropriate template.html  
file to the autoparser based on the value of the page layout field  
like so:

# Switch the template from the three-column to the two column if we  
are using an alternate layout
[globalVar = TSFE:page|layout = 1]
plugin.tx_automaketemplate_pi1 {
content.file = fileadmin/template/twocolA.html

For the three-column, in the backend, it uses the "left, normal,  
right" pagecontent columns. I did this by adding  
"mod.SHARED.colPos_list=1,0,2" to the page TSConfig in the root line.  
(I don't use the 'border' column so I did not include it).

What I would like, is if a page is configured to use 'Layout 1'  
instead of 'Normal' then in the backend the pagecontent columns would  
only show "left, normal", which is achieved by putting  
"mod.SHARED.colPos_list=1,0" in the page TSConfig for that page  
(overriding the root TSConfig for that page)

This is easily done if I put the appropriate  
"mod.SHARED.colPos_list=1,0" entry in each page TSConfig that uses  
the alternate 'layout 1' layout, but I would like to make it  
automatic for our users that may not be so Typo3 savvy. So I was  
hoping to make it automatic, by putting in the root page TSConfig  
something like this:

[If page being viewed in the backend (via 'page') has layout 'normal']

If there is another method of doing this besides TemplaVoila (which  
is a bit too automagic for my taste) I would be happy to know. I am a  
bit confused why you say "Setting the colPos value by TSConfig will  
restrict the user to insert content to just one column." because the  
behavior I see is that it is used to show which columns to display or  
not in the backend page module.



On Jun 24, 2005, at 1:06 PM, Bernhard Kraft wrote:

> Joseph Mesterhazy wrote:
>> Thanks, this is getting me closer, but what is the equivalent of   
>> TSFE:page|layout for the page TSConfig in the backend? I tried   
>> variations such as page:layout, etc. with no success. GP:id=xx  
>> did  work, so the extension is working, but I would like this code  
>> to be  dynamic so I don't have to keep a list of page ID's that  
>> use the  alternate templates.
> Could you tell my why you need this for ?
> If you have two different templates it is not problem to put the  
> contents into the same
> Column ... When one template is selected it gets outputted to a  
> specific column and when
> the other template gets selected it can get outputted to a  
> different column.
> Setting the colPos value by TSConfig (also if just conditional by  
> page layout) will restrict
> the user to insert content to just one column.
> For the condition to work it is necessary that the page-row is  
> loaded somewhere in memory
> when the colPos TSConfig should be set (which is the case when you  
> edit or create a Content
> Element). I checked that but unfortunatly the page, on which the  
> content element to edit resided,
> isn't loaded. The onyl possibility you have is to write some  
> extension which hooks into TCEMain for
> example and loads the page .. then you can make a condition with  
> kb_tsconfig_cond ... but in the
> case you make a hook extension you could modify the colPos value  
> directly out of this extension...
> but I made many sites and never needed such a feature :)
> pherhaps if you explain what you want to achieve we can supply you  
> a better and maybe even simpler solution !
> greets,
> Bernhard
> _______________________________________________
> Typo3-english mailing list
> Typo3-english at lists.netfielders.de
> http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-english

Joe Mesterhazy
ECpE UNIX Administrator
2101 Coover Hall, Iowa State University
Ames, IA 50011.  (515) 294-7359

More information about the TYPO3-english mailing list