Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

How to get part of a variable located after a delimiter

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Installation and Setup
View previous topic :: View next topic  
Author Message
patrmich
Smarty Rookie


Joined: 13 Nov 2012
Posts: 7

PostPosted: Sun Nov 08, 2015 10:28 am    Post subject: How to get part of a variable located after a delimiter Reply with quote

Hi,

In a template file (from Prestashop), I have the following variable
$Essai->Test

The variable takes this kind of value :
string1-string2
where - is a delimiter

How could I get the value of string1 or string2 ?

(I am not a programmer)

Thnak you in advance for any reply.

Patrick
Back to top
View user's profile Send private message
walruslives424
Smarty n00b


Joined: 19 Jul 2016
Posts: 1

PostPosted: Tue Jul 19, 2016 7:07 am    Post subject: Reply with quote

I also need this. minimalist wordpress themes

Last edited by walruslives424 on Fri Sep 23, 2016 12:40 pm; edited 2 times in total
Back to top
View user's profile Send private message
elpmis
Smarty Elite


Joined: 07 Jun 2007
Posts: 321

PostPosted: Tue Jul 19, 2016 7:29 pm    Post subject: Reply with quote

Have you tried to use an explode()?

Code:
{$val = explode('-', $Essai->Test)}


After that this should work

Code:
{$val[0]}
{$val[1]}
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Tue Jul 19, 2016 8:44 pm    Post subject: Reply with quote

You're talking to a spamer-necroposter.
Back to top
View user's profile Send private message
elpmis
Smarty Elite


Joined: 07 Jun 2007
Posts: 321

PostPosted: Tue Jul 19, 2016 8:55 pm    Post subject: Reply with quote

Rolling Eyes
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Installation and Setup All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP