how to get some tags value in smarty?[solved]

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
User avatar
ethan2cyc
Forum Members
Forum Members
Posts: 28
Joined: Sun Jan 09, 2011 1:29 pm

how to get some tags value in smarty?[solved]

Post by ethan2cyc »

hi all,
a example here:

Code: Select all

	<img src="{root_url}/uploads/news/id{$entry->id}/{$entry->thumbnail}" alt="{$entry->title}" width="75" height="75"/>
it works ok, but here:

{assign var="image_url" value=???'/uploads/news/id'|cat:$entry->id|cat:'/'|cat:$entry->thumbnail}
{supersizer width='200' height='160' crop='left,top,50' path=$image_url strip_tags=true passthru=true}


how to get a the root_url value? I try $root_url and {root_url} in {} but no works.
Last edited by ethan2cyc on Sat Apr 02, 2011 6:50 am, edited 1 time in total.
Wishbone
Power Poster
Power Poster
Posts: 1368
Joined: Tue Dec 23, 2008 8:39 pm

Re: how to get some tags value in smarty?

Post by Wishbone »

You could use {capture} to get the value of {root_url} into a variable called {$root_url}

Code: Select all

{capture assign='root_url'}{root_url}{/capture}
{assign var="image_url" value="$root_url/uploads/news/id"|cat:$entry->id|cat:'/'|cat:$entry->thumbnail}
or just use a relative path

Code: Select all

{assign var="image_url" value="uploads/news/id"|cat:$entry->id|cat:'/'|cat:$entry->thumbnail}
User avatar
ethan2cyc
Forum Members
Forum Members
Posts: 28
Joined: Sun Jan 09, 2011 1:29 pm

Re: how to get some tags value in smarty?

Post by ethan2cyc »

Thank you so much!
Post Reply

Return to “Developers Discussion”