I want to check if file exists in template and for that I'd need a variable with path to the file
I have a loop {section name=i loop=$albums}
What I'd do in php:
$filename = $url . '/path/' . $albums[i].AID . '.jpg';
And I have the path to the file but I can't find a way to do this in smarty template
I have tried to do it inside of {php} tags
this->assign('filename', "$relative . '/media/albums/' . '$albums[i].AID' . 'jpg'");
But result is just
. '/media/albums/' . '.AID' . 'jpg'1
I also tried to do it with {assign var name=filename val=$relative . '/media/albums/' . '$albums[i].AID' . 'jpg' and many variations of this, but the result is similar as with php tags.
I just can't get it to recognize the other variables.
Can this be done with smarty at all?
Ok, fixed it. For anyone having similar problem in the future with smarty, use for example:
{assign var name=file val=$albums[i].AID}
{assign var name=filename val=/direct/localpath/public_html/media/albums/$file.jpg}
That worked for me.