473,378 Members | 1,531 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

X-Cart/Smarty Custom PHP Scripts

162 100+
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.
[php]
{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}
[/php]I need to remove spaces in the names given at
Expand|Select|Wrap|Line Numbers
  1. name="{$c.category}_"
I want to make it
Expand|Select|Wrap|Line Numbers
  1. 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\Sm arty-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.
Mar 17 '08 #1
1 1916
empiresolutions
162 100+
Thanks Jay. Here's the solution-
Expand|Select|Wrap|Line Numbers
  1. {$c.category|replace:" ":""}
im now finding that slashes are not allowed either.
Expand|Select|Wrap|Line Numbers
  1. {$c.category|replace:" ":""|replace:"/":""}
works too. sweet.
Mar 17 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Richard | last post by:
I need help. I have a smarty based program that I am modifying. I have a smarty template file that consists of smarty and HTML. I need to integrate some PHP database calls into it. My problem...
2
by: Mike | last post by:
I am sure that I am making a simple boneheaded mistake and I would appreciate your help in spotting in. I have just installed apache_2.0.53-win32-x86-no_ssl.exe php-5.0.3-Win32.zip...
1
by: DJ Majestik | last post by:
OK, I am new to the whole PEAR/Smarty templating thing. I am trying to setup my directory structure correctly. If someone could weigh in and see if I have this setup "right", I would appreciate it....
2
by: M | last post by:
Hi Folks, I am trying to install Smarty using PHP 5 on a Windows XP PC using IIS v6 The following PHP File: <!doctype html public "-//W3C//DTD HTML 4.0 //EN"> <html> <head>
0
by: Matt | last post by:
geez, i've done this a million times, you'd think i could get it right. uploading to production server for a new site, and part of the head.inc that starts everything up looks like this: echo...
0
by: lkrubner | last post by:
My boss gave me this assignment: "Change all the URLs on our website so that they no longer look like dynamic URLs. Make them look like folders." I spent all yesterday studying Apache...
2
by: Man-wai Chang | last post by:
I meant something like: {section name=j start=0 loop=10 step=1} {php} $xx={$smarty.section.j.index}; echo $xx; {/php} {/section} -- iTech Consulting Services Limited Expert of ePOS...
6
by: alvarojaviervera | last post by:
Im programer (about 2 years ago I started), and allways I use PEAR. and Now I was thinking about change my tool for building custom dynamic sites. What do you think sholud be better Smarty, may be...
3
by: deshaipet | last post by:
db2level = V97 FP 2. Oslevel = AIX 6.1 TL 03. TSAMP level = 3.1 FP 06 Hi, In todays world we have TSAMP HADR monitoring scripts which monitoring scripts to monitor failures in HADR system....
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.