[TYPO3-UG US] TypoScript conditions refresher

georg kuehnberger georg at georg.org
Sat Apr 12 20:12:47 CEST 2008


Finees,
In order to keep the TS more modular and mantainable (eg. moving your 
template into other subdir), you might consider the below example.
hth, regard georg

### CONSTANTS
IMG_PATH = fileadmin/templates/zwire/images/gfx

### SETUP
page.1.subparts.PAGEHEADER.file.10 {
	[PIDinRootline = 38 ]
		file = {$IMG_PATH}/page-header01.jpg
	[PIDinRootline = 32 ]
		file = {$IMG_PATH}/page-header02.jpg
	[global]
	file = {$IMG_PATH}/page-header.jpg
	.
	.....
}




Finees Mendez wrote:
> Yes. But then I have to dig in to each page to make updates. I figured out what i was doing wrong, and here is the updated code. First set the global param, and then just change if condition is met. Thank you.
> 
> # First set my global condition 
> page.1.subparts.PAGEHEADER.file.10.file = fileadmin/templates/zwire/images/gfx/page-header.jpg
> 
> [PIDinRootline = 38 ]
> page.1.subparts.PAGEHEADER.file.10.file = fileadmin/templates/zwire/images/gfx/page-header01.jpg
> [end]
> 
> [PIDinRootline = 32 ]
> page.1.subparts.PAGEHEADER.file.10.file = fileadmin/templates/zwire/images/gfx/page-header02.jpg
> [end]
> 
> [PIDinRootline = 31 ]
> page.1.subparts.PAGEHEADER.file.10.file = fileadmin/templates/zwire/images/gfx/page-header03.jpg
> [end]
> 
> [PIDinRootline = 24 ]
> page.1.subparts.PAGEHEADER.file.10.file = fileadmin/templates/zwire/images/gfx/page-header04.jpg
> [end]
> 
> [PIDinRootline = 18 ]
> page.1.subparts.PAGEHEADER.file.10.file = fileadmin/templates/zwire/images/gfx/page-header05.jpg
> [end]
> 
> [PIDinRootline = 16 ]
> page.1.subparts.PAGEHEADER.file.10.file = fileadmin/templates/zwire/images/gfx/page-header06.jpg
> [end]
> 
> ----- Original Message ----
> From: Michael Cannon <michael at cannonbose.com>
> To: Finees Mendez <fineesmendez at yahoo.com>; TYPO3 Usergroup America <typo3-ug-us at lists.netfielders.de>
> Sent: Monday, March 24, 2008 6:31:12 PM
> Subject: Re: [TYPO3-UG US] TypoScript conditions refresher
> 
> Finees,
> 
> Why not just stick the page.1.subparts... code into a TypoScript
> template on those pages instead of worrying about the condition code?
> 
> This way you really do know where those images are at on the site and
> are clear about them also changing their subpages as well.
> 
> On Mon, Mar 24, 2008 at 3:38 PM, Finees Mendez <fineesmendez at yahoo.com> wrote:
>> Hi all,
>>
>>  I am working on a graphics header for the subpages of the website. I am attempting to display a different image for each subpage in the first sub level only. Here is the code below, but my question is in regard to best TS coding practices. How can I write an IFELSE statement with TS. Below is a functional code, but not the best efficient. I know that operators like [else] [end] and [global] work, but what about an ifelse, a multi conditional statement. Your thoughts? Thank you.
>>
>>  Code:
>>
>>  [PIDinRootline = 38 ]
>>  page.1.subparts.PAGEHEADER.file.10.file = fileadmin/templates/zwire/images/gfx/page-header01.jpg
>>  [else]
>>  page.1.subparts.PAGEHEADER.file.10.file = fileadmin/templates/zwire/images/gfx/page-header.jpg
>>  [end]
>>
>>  [PIDinRootline = 32 ]
>>  page.1.subparts.PAGEHEADER.file.10.file = fileadmin/templates/zwire/images/gfx/page-header02.jpg
>>  [else]
>>  page.1.subparts.PAGEHEADER.file.10.file = fileadmin/templates/zwire/images/gfx/page-header.jpg
>>  [end]
>>
>>  [PIDinRootline = 31 ]
>>  page.1.subparts.PAGEHEADER.file.10.file = fileadmin/templates/zwire/images/gfx/page-header03.jpg
>>  [else]
>>  page.1.subparts.PAGEHEADER.file.10.file = fileadmin/templates/zwire/images/gfx/page-header.jpg
>>  [end]
>>
>>  [PIDinRootline = 24 ]
>>  page.1.subparts.PAGEHEADER.file.10.file = fileadmin/templates/zwire/images/gfx/page-header04.jpg
>>  [else]
>>  page.1.subparts.PAGEHEADER.file.10.file = fileadmin/templates/zwire/images/gfx/page-header.jpg
>>  [end]
>>
>>  [PIDinRootline = 18 ]
>>  page.1.subparts.PAGEHEADER.file.10.file = fileadmin/templates/zwire/images/gfx/page-header05.jpg
>>  [else]
>>  page.1.subparts.PAGEHEADER.file.10.file = fileadmin/templates/zwire/images/gfx/page-header.jpg
>>  [end]
>>
>>  [PIDinRootline = 16 ]
>>  page.1.subparts.PAGEHEADER.file.10.file = fileadmin/templates/zwire/images/gfx/page-header06.jpg
>>  [else]
>>  page.1.subparts.PAGEHEADER.file.10.file = fileadmin/templates/zwire/images/gfx/page-header.jpg
>>  [end]
>>
>>
>>
>>
>>       ____________________________________________________________________________________
>>  Never miss a thing.  Make Yahoo your home page.
>>  http://www.yahoo.com/r/hs
>>  _______________________________________________
>>  TYPO3-UG-US mailing list
>>  TYPO3-UG-US at lists.netfielders.de
>>  http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-ug-us
>>
> 
> 
> 


More information about the TYPO3-UG-US mailing list