473,408 Members | 2,888 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,408 software developers and data experts.

How to use this function in Smarty?

133 100+
Hi,

Can someone please help me, i am trying to use this function but simply wont display when i try it.

The function is:

[php]function stripres($value){

$value = strtr($value, "éèêàëâúóíáABCDEFGHIJKLMNOPQRSTUVWXYZ. ","eeeaeauoiaabcdefghijklmnopqrstuvwxyz--");
$value = ereg_replace('[^a-zA-Z0-9_-]', '', $value);

return $value;

}[/php]

I am trying to use this by:

{stripres($result.subcategory)}

What am i doing wrong?

Cheers,
Adam
Feb 12 '08 #1
1 3001
dlite922
1,584 Expert 1GB
Hi,

Can someone please help me, i am trying to use this function but simply wont display when i try it.

The function is:

[php]function stripres($value){

$value = strtr($value, "éèêàëâúóíáABCDEFGHIJKLMNOPQRSTUVWXYZ. ","eeeaeauoiaabcdefghijklmnopqrstuvwxyz--");
$value = ereg_replace('[^a-zA-Z0-9_-]', '', $value);

return $value;

}[/php]

I am trying to use this by:

{stripres($result.subcategory)}

What am i doing wrong?

Cheers,
Adam
i don't think you can access PHP functions like that from smarty. You can modify smarty and add that custom function to smarty class.

Where is your smarty assign() lines?

My suggestion, put that into a class, create an instance, assign it to smarty and access it like this

{$assignedName->stripres($result.category)}

IF YOU WANT TO CONVERT TO LOWERCASE DO THIS

{$result.category|lower}

change lower to upper if you want it upper case.
Feb 20 '08 #2

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

Similar topics

1
by: jpastora | last post by:
I'm trying to generate an array for a price selection box and i keep getting this error on the php page: "Parse error: parse error, expecting `'('' in /var/www/html/site/index.php on line 13" ...
2
by: Daan | last post by:
Hello all, I'm having a little problem with Smarty. Getting it to work in a simple case went fine, but now I have the following situation: / /smarty /templates template.tpl /templates_c
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...
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....
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...
7
by: William Krick | last post by:
I'm fairly new to PHP and Smarty templates and I don't understand... $smarty = new Smarty; ....vs... $smarty = new Smarty(); ....vs...
0
by: ev45ive | last post by:
Hi! I have smth. like this: file.php: <?php SmartyValidate::connect($smarty); //SmartyValidate::register_form('register');
1
by: RuthC | last post by:
I am trying to pass a smarty array to a javascript function what is he easiest way to pass the values? I tried these code but not working. Please help me where i am wrong. <?php $url_names =...
6
by: K. | last post by:
Hello! I have a problem with using php on smarty web page I would like to use a php code from this web page: http://www.money.pl/webmaster/# i.e.. <?php readfile...
1
by: ajaymohank | last post by:
hello friends.......... i am new to smarty. can anyone please tell me how to get the value from a dynamically generated checkbox using smarty. this is the code i used... here i am generating 10...
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: 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...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.