A Smarty Tag within a Smarty tag?
A Smarty Tag within a Smarty tag?
Is there a way to combine a smarty tag within a smarty tag when using it on a CMSMS template?
What i want is to combine these two functions (and perhaps the "tag within a tag" route is not the way to go):
http://dev.cmsmadesimple.org/projects/sectiontitle
http://dev.cmsmadesimple.org/projects/rotate
So i have a user defined tag {sectiontitle} that i want to pull into the path display for {rotate}.
End result would be something like this:
{rotate path="photos/{sectiontitle}/featured/"}
Perhaps there is someone out there smart enough to combine the two codes into one code for me so that it works how i want it to!!
I am designer and not a coder but i know this has to be possible!
What i want is to combine these two functions (and perhaps the "tag within a tag" route is not the way to go):
http://dev.cmsmadesimple.org/projects/sectiontitle
http://dev.cmsmadesimple.org/projects/rotate
So i have a user defined tag {sectiontitle} that i want to pull into the path display for {rotate}.
End result would be something like this:
{rotate path="photos/{sectiontitle}/featured/"}
Perhaps there is someone out there smart enough to combine the two codes into one code for me so that it works how i want it to!!
I am designer and not a coder but i know this has to be possible!
Re: A Smarty Tag within a Smarty tag?
I don't think there is any way...
the closest may be
{rotate path="photos/`sectiontitle`/featured/"}
but you'll most likely have to do
{capture assign=foo}{sectiontitle}{/capture}
{rotate path="photos/`$foo`/featured/"}
Hope that helps.. Cheers -Jeremy
the closest may be
{rotate path="photos/`sectiontitle`/featured/"}
but you'll most likely have to do
{capture assign=foo}{sectiontitle}{/capture}
{rotate path="photos/`$foo`/featured/"}
Hope that helps.. Cheers -Jeremy
Re: A Smarty Tag within a Smarty tag?
thanks for your reply but that doesnt seem to work - at least if i paste that into the html template. I am thinking the solution has to be a combination of the two tags into one tag, using the php. i just have no idea how to begin doing that. 

Re: A Smarty Tag within a Smarty tag?
you did
{capture assign='foo'}{sectiontitle}{/capture}
{rotate path='photos/`$foo`/featured/'}
and it didn't work?
{capture assign='foo'}{sectiontitle}{/capture}
{$foo}
will output something if the {sectiontitle} output something.. if not then that is where the issue lays..
{capture assign='foo'}{sectiontitle}{/capture}
{rotate path='photos/`$foo`/featured/'}
and it didn't work?
{capture assign='foo'}{sectiontitle}{/capture}
{$foo}
will output something if the {sectiontitle} output something.. if not then that is where the issue lays..
Re: A Smarty Tag within a Smarty tag?
both features work fine on their own they just dont combine (obviously)
This is the output i get when i use that code:
: array_rand() [function.array-rand]: Second argument has to be between 1 and the number of elements in the array in /homepages/0/d352877081/htdocs/plugins/function.rotate.php on line 157
Warning: Invalid argument supplied for foreach() in /homepages/0/d352877081/htdocs/plugins/function.rotate.php on line 160
This is the output i get when i use that code:
: array_rand() [function.array-rand]: Second argument has to be between 1 and the number of elements in the array in /homepages/0/d352877081/htdocs/plugins/function.rotate.php on line 157
Warning: Invalid argument supplied for foreach() in /homepages/0/d352877081/htdocs/plugins/function.rotate.php on line 160
Re: A Smarty Tag within a Smarty tag?
what does
{capture assign='foo'}{sectiontitle}{/capture}
{$foo}
output.. that is the key... cause if it's just a string then {rotate path="photos/$foo/featured/"}
should have no issue.. if it's returning something other then a string then that is why..
{capture assign='foo'}{sectiontitle}{/capture}
{$foo}
output.. that is the key... cause if it's just a string then {rotate path="photos/$foo/featured/"}
should have no issue.. if it's returning something other then a string then that is why..
Re: A Smarty Tag within a Smarty tag?
i should mention that the capture assign does output the right text it should, it just seems that it won't work within the {rotate} tag:
{capture assign='foo'}{sectiontitle}{/capture}
{$foo}
Though i do notice that if you stare long enough, something DOES seem to be fading in and out behind the error code? Quite strange. Not sure what its doing behind there!
See here for working photo (no smarty tag within smarty tag):
http://s352877102.onlinehome.us/index.php?page=shopping
And see here for broken photo (using your code replacement):
http://s352877102.onlinehome.us/index.php?page=dining
{capture assign='foo'}{sectiontitle}{/capture}
{$foo}
Though i do notice that if you stare long enough, something DOES seem to be fading in and out behind the error code? Quite strange. Not sure what its doing behind there!
See here for working photo (no smarty tag within smarty tag):
http://s352877102.onlinehome.us/index.php?page=shopping
And see here for broken photo (using your code replacement):
http://s352877102.onlinehome.us/index.php?page=dining
Re: A Smarty Tag within a Smarty tag?
here is the test then.. if you put
{capture assign='foo'}{sectiontitle}{/capture}
{$foo}
and lets say {$foo} outputs "bar" (also I'd just in case add --{$foo}-- so you can see if there is spaces creeping in somehow...) then I'd next go and hard code the rotator {rotate path='photos/bar/featured/'}
if that does work and the is no space the last thing would be to do this..
{capture assign='foo'}photos/{sectiontitle}/featured/{/capture}
{rotate path=$foo}
if that don't work.. well .. there has to be a typo or something somewhere.. something simple..
if there is a space just ad |trim {rotate path='photos/`$foo|trim `/featured/'}
Also just in case.. you do notice the back ticks verse single quotes.. I think that covers it all.
HTH Cheers -Jeremy
{capture assign='foo'}{sectiontitle}{/capture}
{$foo}
and lets say {$foo} outputs "bar" (also I'd just in case add --{$foo}-- so you can see if there is spaces creeping in somehow...) then I'd next go and hard code the rotator {rotate path='photos/bar/featured/'}
if that does work and the is no space the last thing would be to do this..
{capture assign='foo'}photos/{sectiontitle}/featured/{/capture}
{rotate path=$foo}
if that don't work.. well .. there has to be a typo or something somewhere.. something simple..
if there is a space just ad |trim {rotate path='photos/`$foo|trim `/featured/'}
Also just in case.. you do notice the back ticks verse single quotes.. I think that covers it all.
HTH Cheers -Jeremy
-
- Forum Members
- Posts: 24
- Joined: Sat Jan 09, 2010 4:38 pm
Re: A Smarty Tag within a Smarty tag?
Try:
Code: Select all
{capture assign='foo'}photos/{sectiontitle}/featured/{/capture}
{rotate path=$foo}
Re: A Smarty Tag within a Smarty tag?
Interesting. I got excited because i thought it was working, but it only seems to work on the dining page? Even though i have the same template for all pages?
http://s352877102.onlinehome.us/index.php?page=dining
How could it work on one page but not the other? how do i debug this?
http://s352877102.onlinehome.us/index.php?page=shopping
http://s352877102.onlinehome.us/index.php?page=dining
How could it work on one page but not the other? how do i debug this?
http://s352877102.onlinehome.us/index.php?page=shopping
-
- Forum Members
- Posts: 24
- Joined: Sat Jan 09, 2010 4:38 pm
Re: A Smarty Tag within a Smarty tag?
Put {$foo} right after it to see what it is passing in.
If it works on one, verify that there are images there for the other pages.
If it works on one, verify that there are images there for the other pages.
{SOLVED} A Smarty Tag within a Smarty tag?
NEVERMIND! I figured it out - i only had 1 photo for the other sections (still getting content up!) so thats why the For Each was throwing an error, it can't just rotate one photo.
THANK YOU for your help!! Very much appreciated.

THANK YOU for your help!! Very much appreciated.
