Page 1 of 1
Syntax
Posted: Sat Aug 30, 2008 10:41 am
by reinhardl
Hi,
who can I realize something like this:
Code: Select all
<img src="{serendipity_getFile file="img/{$template_option.colorset}_graph_bar_horisontal.png"}
I think {$template_option.colorset} is the problem ...
Re: Syntax
Posted: Sat Aug 30, 2008 1:41 pm
by garvinhicking
Hi!
I believe something like this could work:
Code: Select all
{assign var="searchfile" value=`img/{$template_option.colorset}_graph_bar_horisontal.png`}
<img src="{serendipity_getFile file=$searchfile}" />
HTH,
Garvin
Re: Syntax
Posted: Sat Aug 30, 2008 3:19 pm
by reinhardl
garvinhicking wrote:Hi!
I believe something like this could work:
Code: Select all
{assign var="searchfile" value=`img/{$template_option.colorset}_graph_bar_horisontal.png`}
<img src="{serendipity_getFile file=$searchfile}" />
HTH,
Garvin
if I use this:
Code: Select all
{assign var="searchfile" value='img/{$template_option.colorset}_graph_bar_horisontal.png'}
file={$searchfile}-<br>
I will get output like this:
_graph_bar_horisontal.png'} file=img/{Array.colorset-
option.colorset is defined in
Code: Select all
$template_config = array(
array(
'var' => 'colorset',
'name' => THEME_COLORSET,
'type' => 'select',
'default' => '',
'select_values' => $colorsets
),
same as bulletproof
Re: Syntax
Posted: Sat Aug 30, 2008 4:42 pm
by garvinhicking
Hi!
Why did you use different code than I pasted?
I used `and not ', that makes a big difference...
Regards,
Garvin
Re: Syntax
Posted: Sat Aug 30, 2008 5:05 pm
by reinhardl
garvinhicking wrote:Hi!
Why did you use different code than I pasted?
I used `and not ', that makes a big difference...
because
Code: Select all
{assign var="searchfile" value=`img/{$template_option.colorset}_graph_bar_horisontal.png`}
file={$searchfile}-<br>
will produce following:
_graph_bar_horisontal.png`} file=`img/{Array.colorset-
Re: Syntax
Posted: Sat Aug 30, 2008 9:28 pm
by garvinhicking
Hi!
Ah, I see, the { and } shouldn't be in there. Can you try:
Code: Select all
{assign var="searchfile" value=`'img/' + $template_option.colorset + '_graph_bar_horisontal.png'`}
file={$searchfile}-<br>
instead? Maybe this works. The problem is that you append something after your colorset name, which usually would look like a variable name to smarty.
If the above does not work, you need to use PHP code inside your config.inc.php:
Code: Select all
$template_loaded_config = serendipity_loadThemeOptions($template_config, $serendipity['smarty_vars']['template_option']);
$serendipity['smarty']->assign('searchfile', 'img/' . $template_loaded_config['colorset'] . '_graph_bar_horisontal.png');
HTH,
Garvin