Help required passing a dynamic variable to a User Defined Tag in 1 template

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Locked
bash

Help required passing a dynamic variable to a User Defined Tag in 1 template

Post by bash »

Hi everyone. I'm not sure if there is a better way to handle this process... I'll do my best to explain what I am trying to accomplish.

I have one master template which each page in my site uses. Within this template, there is a specific banner image that I would like to have control over by setting its src attribute on a per-page basis. I don't want to make duplicate copies of the master template since nothing more than the src attribute of this one tag will change. Is there a way that I can set some kind of placeholder variable in the master template which can be overwritten on a page-by-page basis? If so, how do I set this and how to I assign this variable from content blocks?

The UDT that I was thinking of placing in the master template would look something like this:

Code: Select all

{banner src="page_banner"}
Is there a way to set the variable for page_banner from each content block so that when the template gets evaluated, the proper image is shown? Am I going about this all wrong?

Thanks and sorry if this is rookie stuff.
User avatar
Nullig
Power Poster
Power Poster
Posts: 2380
Joined: Fri Feb 02, 2007 4:31 pm

Re: Help required passing a dynamic variable to a User Defined Tag in 1 template

Post by Nullig »

If you name your banner images the same as the page alias, you could put this in your template.



Nullig
Last edited by Nullig on Sun Mar 30, 2008 3:23 pm, edited 1 time in total.
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: Help required passing a dynamic variable to a User Defined Tag in 1 template

Post by calguy1000 »

See my post tips & tricks forum about controlling the template from the page... it's a sticky.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Locked

Return to “CMSMS Core”