Jump to content

X-Cart/Smarty Custom PHP Scripts


cesarcesar

Recommended Posts

i have what may be a very simple question for someone who has worked with X-Cart or Smarty.

 

I am adding a rollover image next to the category names in the main navigation. The following is my stripped down for this post version.

        
{foreach from=$categories item=c}

     <div>

          <div><img name="{$c.category}_" src="{$ImagesDir}/custom/paw.gif"></div>
          <div><a href="home.php?cat={$c.categoryid}">{$c.category}</a></div>

     </div>

{/foreach}

I need to remove spaces in the names given at

name="{$c.category}_"

I want to make it

name="{str_replace(" ","_",$c.category)}_"

My attempts don't work and I get this error

Error: Smarty error: [in customer/categories.tpl line 26]: syntax error: unrecognized tag: str_replace(" ","_",$c.category) (Smarty_Compiler.class.php, line 436) in C:\apache2triad\htdocs\clients\sitename.com\www\Smarty-2.6.12\Smarty.class.php on line 1095
My question is.. How can I make PHP functions work in X-Cart/Smarty?

 

I cant even find where $c.category is set. Thanks much.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.