473,569 Members | 2,542 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help with Smarty

Hello you all, =]
I've a smarty var, like this:
{$var}
that is equal to: ttttttttttttt|z zzzzzzzzzzz

It can be any size, the important is that they are separated by the '|'

How do I 'explode' that into an array or 2 variables in the smarty template
?

So I can just use:
{$var[0]} = ttttttttttttt;
{$var[0]} = zzzzzzzzzzzz;

Tks in advance

Freebird
Nov 24 '05 #1
2 4947

"Freebird" <pe*****@hotmai l.com> wrote in message
news:dm******** **@domitilla.ai oe.org...
Hello you all, =]
I've a smarty var, like this:
{$var}
that is equal to: ttttttttttttt|z zzzzzzzzzzz

It can be any size, the important is that they are separated by the '|'

How do I 'explode' that into an array or 2 variables in the smarty template ?

So I can just use:
{$var[0]} = ttttttttttttt;
{$var[0]} = zzzzzzzzzzzz;

Tks in advance

Freebird


Try explode( ) like this:
$pizza = "piece1 piece2 piece3 piece4 piece5 piece6";
$pieces = explode(" ", $pizza);
echo $pieces[0]; // piece1
echo $pieces[1]; // piece2
*** reference: http://us2.php.net/manual/en/function.explode.php
Nov 24 '05 #2
HERE'S MY QUESTION:

I've a smarty var, like this:
{$var}
that is equal to: ttttttttttttt|z zzzzzzzzzzz

It can be any size, the important is that they are separated by the '|'

How do I 'explode' that into an array or 2 variables in the smarty template
?

So I can just use:
{$var[0]} = ttttttttttttt;
{$var[0]} = zzzzzzzzzzzz;
HERE'S YOUR ANSWER,

Try explode( ) like this:
$pizza = "piece1 piece2 piece3 piece4 piece5 piece6";
$pieces = explode(" ", $pizza);
echo $pieces[0]; // piece1
echo $pieces[1]; // piece2
*** reference: http://us2.php.net/manual/en/function.explode.php


DO YOU READ THE MESSAGES BEFORE YOU ANSWER THEM ?
DO YOU THINK I DON'T KNOW HOW TO USE EXPLODE ?
I WAS REALLY CLEAR, TAKE IT A LOOK AT THE QUESTION ABOVE, I NEED TO THAT
WITHIN SMARTY TEMPLATES, GET IT ?
INSIDE SMARTY TEMPLATES, SMARTY !
TKS
Freebird

Nov 24 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
15463
by: Brian | last post by:
Hello, I am trying to work out how to have smarty use a string's contents as the display-> template.. ie: $smarty->display($buffer); obviously $buffer isn't a filename, but a smarty template inside a string variable. Take this example:
2
2897
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
2
2600
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
1574
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 SMARTY_DIR."Smarty.class.php<br>"; require_once(SMARTY_DIR."Smarty.class.php"); if (substr(phpversion(),0,1) == "4") { $smarty = new Smarty;
0
1596
by: Conrad | last post by:
Hi, I'm very new to Smarty Template Engine and I'm using PHP 5.0.4 on the Windows XP Professional platform and I have the following question: When I change the 7th line of the script to use a new name and refresh the browser, it maintains the old value instead of updating to the new value. Both index.php and SmartySetup.class.php appear...
12
1293
by: bryan | last post by:
I've posted before but no one replied because I think it was confusing. My problem is that I have a website where users have profile pages, and they can each chooser their own (i.e. blogger.com) Point of this question is...how can I make a system where template layouts (e.g, 3 column layout, 2 column, vertical, horizontal) can be created for...
0
2801
by: ev45ive | last post by:
Hi! I have smth. like this: file.php: <?php SmartyValidate::connect($smarty); //SmartyValidate::register_form('register');
0
2139
by: grezlik | last post by:
Hi! I have major problems with cakephp & smarty, (cake ver is 1.2 and smarty 2.6.18 ) there is a code (from cake/libs/view/view.php class SmartyView { .. .. ..
1
2602
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 checkbox. but i am not getting the value when each checkbox is checked. the value is coming from the array $profservices. how can i get the value from each...
0
7614
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7924
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8125
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7676
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7974
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5219
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3642
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1221
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
938
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.