[Typo3] GlobalVar - this one *should* be simple, right ... ? [SOLVED!]

Scotty C superscotty19 at yahoo.com
Wed Dec 14 19:07:33 CET 2005


Christopher,

You are BRILLIANT!!! Here is what I did (for the
reference of others). This will give a different
template for the root page:


Create page tree like so:


www.mysite.com (id = 286)
   +  About (id = 295)
   +  Contact (id = 294)
   +  Products (id = 293)

-> The page "www.mysite.com" (id=286) must have "is
root of site" set in page header!


In the TS for www.mysite.com, add the following to the
constants:

templateFile = fileadmin/xpressxperience/template.html
[treeLevel = 0]
templateFile = fileadmin/xpressxperience/home.html
[global]

This will set the default template to be
template.html, but use home.html for the root of the
web site (i.e. pageid=286)


Then the setup becomes easy! Just implement the
template like so:

page.19 = TEMPLATE
page.19 {
     template = FILE
     template.file = {$templateFile}

     # insert your custom code here

} # end template


Thanks again Christopher - I hope this can be of help
to others, as it certainly was for me!

-Scott.



--- Christopher <bedlamhotel at gmail.com> wrote:

> Hi,
> 
> On 12/14/05, Scotty C <superscotty19 at yahoo.com>
> wrote:
> > Hi everyone,
> >
> > This one's got me puzzled. I've used globalVar
> before
> > to check a condition and it's worked fine. Now,
> I'm
> > using it for another site, but the code won't
> work!
> > The siutation is, I'd like to use 2 different
> > templates depending on the page id. Here's my
> code:
> >
> > Constants:
> > -----------
> >
> > # default template file
> > templateFile =
> fileadmin/xpressxperience/template.html
> >
> > # use this template file if pageid = 286
> > [globalVar = TSFE:id = 286]
> > templateFile = fileadmin/xpressxperience/home.html
> > [end]
> >
> >
> > Setup:
> > -------
> >
> <snip>
> 
> I don't think that constants are parsed for
> conditions. Try something
> like this instead:
> 
> Constants:
> --------------------
> 
> default_template =
> fileadmin/xpressxperience/template.html
> template_1 = fileadmin/xpressxperience/home.html
> 
> Setup:
> 
> --------------------
> 
> templateFile =
> fileadmin/xpressxperience/template.html
> [globalVar = TSFE:id = 286]
> templateFile = fileadmin/xpressxperience/home.html
> [global]
> 
> Incidentally, if the page with id=286 is the root of
> the website, you
> can try a different kind of condition (that will not
> require fixing if
> the root page of the site ever changes):
> 
> [treeLevel = 0]
> templateFile = fileadmin/xpressxperience/home.html
> [global]
> 
> 
> -Christopher
> _______________________________________________
> Typo3-english mailing list
> Typo3-english at lists.netfielders.de
>
http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-english
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam
protection around 
http://mail.yahoo.com 

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



More information about the TYPO3-english mailing list