I have a UDT that creates a list of values, e.g. a,b,c,d, that I need to pass to a parameter of another tag.
I have the following code in my template
{capture assign='tmpymabii'}{getYMABII}{/capture}
{content block="ymabii1" type="dropdown" label="ymabii1" page_tab="main" items=$tmpymabii assign='ymabiiblock1'}
if I just output {$tmpymabii} then it writes my list to the page but if I try to pass it to the items param it doesn't put anything in there.
I need to be able to dynamically create the list of options to be passed through to the dropdown box. Is there any other way I can pass my values to a param?
thanks
Using a tag value as another tag's parameter
-
- Forum Members
- Posts: 57
- Joined: Thu Jan 17, 2008 3:58 pm
Re: Using a tag value as another tag's parameter
Hi,
It is simple. In first UDT (getYMABII) use the following code:
Then you need only (no capture)
vilkis
It is simple. In first UDT (getYMABII) use the following code:
Code: Select all
global $gCms;
$smarty =& $gCms->GetSmarty();
$smarty->assign('tmpymabii', $YOUR_ARRAY_VARIABLE);
Code: Select all
{getYMABII}
{content block="ymabii1" type="dropdown" label="ymabii1" page_tab="main" items=$tmpymabii assign='ymabiiblock1'}
-
- Forum Members
- Posts: 57
- Joined: Thu Jan 17, 2008 3:58 pm
Re: Using a tag value as another tag's parameter
hi, that doesn't work either!
my UDT is
and then I have
{getYMABII}
{content block="ymabii1" type="dropdown" label="ymabii1" page_tab="main" items=$ymabiiarray assign='ymabiiblock1'}
in my template
my UDT is
Code: Select all
global $gCms;
$db = &$gCms->db;
$smarty =& $gCms->getSmarty();
$page_alias = $smarty->get_template_vars('page_alias');
$myquery = "SELECT * FROM YMABII WHERE published = 'Published' ORDER BY name ASC";
$myresult = $db->Execute( $myquery );
$ymabiiarray = ' Please Select##Please Select';
while ($myresult && $row = $myresult->FetchRow())
{
$ymabiiarray .= ','.$row['id'].'##'.$row['name'];
}
$smarty->assign('ymabiiarray', $ymabiiarray);
{getYMABII}
{content block="ymabii1" type="dropdown" label="ymabii1" page_tab="main" items=$ymabiiarray assign='ymabiiblock1'}
in my template
Re: Using a tag value as another tag's parameter
Best to read here... http://forum.cmsmadesimple.org/index.ph ... #msg192498
There is no processing on the page editing area... so $ymabiiarray of
{content block="ymabii1" type="dropdown" label="ymabii1" page_tab="main" items=$ymabiiarray assign='ymabiiblock1'}
wouldn't work... but as you'll read I have solved this issue...
HTH Cheers
jeremyBass
There is no processing on the page editing area... so $ymabiiarray of
{content block="ymabii1" type="dropdown" label="ymabii1" page_tab="main" items=$ymabiiarray assign='ymabiiblock1'}
wouldn't work... but as you'll read I have solved this issue...
HTH Cheers
jeremyBass
-
- Forum Members
- Posts: 57
- Joined: Thu Jan 17, 2008 3:58 pm
Re: Using a tag value as another tag's parameter
hi, thanks for that but when I try your versions of content and function.content it breaks my site. I'm guessing that's because your code is for 1.6 and my site is 1.5?
Do you know what changes I would need to make to get it to do the dynamic params bit in the code for the older version? is it just a couple of functions I would need to change or the whole thing?
Thank you
Rachael
Do you know what changes I would need to make to get it to do the dynamic params bit in the code for the older version? is it just a couple of functions I would need to change or the whole thing?
Thank you
Rachael
Re: Using a tag value as another tag's parameter
Just upgrade... upgrading is simple and you can jump up to 1.6.6 in about 15 mins... besides you need to do that to get support if something goes wrong... but don't forget to back up... Cheers -J
-
- Forum Members
- Posts: 57
- Joined: Thu Jan 17, 2008 3:58 pm
Re: Using a tag value as another tag's parameter
Hi, I upgraded my site and tried your content type files. It adds the dynamic drop downs perfectly however the normal page content no longer shows on my site! So now I have the drop downs working in my admin area but no text on any of my pages
any ideas what I have done?
thanks
any ideas what I have done?
thanks