Jump to content

Can I combine text and variable into new variable within tpl file?


Recommended Posts

Hi.

 

I'm trying to figure out a way to insert image into my product pages. I'm wondering if what I'm thinking is possible?

 

- Create images using product name as file name. So if the product is ABC123, the image would be ABC123.jpg

 

- Next, how do I combine text with variable? What I need is probably like this

$theURL = http://site/dir/dir/ ... + ... {$product->name|escape:'htmlall':'UTF-8'} .. + .jpg

Then I'll use that with file_exists

{if file_exists($theURL) [spam-filter]
    <img src="{$theURL}">
{/if}

Possible to do this all in the .tpl file?

Any help appreciate, thanks!

Edited by panupat (see edit history)
Link to comment
Share on other sites

  • 1 year later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...