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

STA PHP to Smarty -- can you help me?

 
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 -> General
View previous topic :: View next topic  
Author Message
MarketingJunkie
Smarty Regular


Joined: 08 Jan 2007
Posts: 42

PostPosted: Mon Jan 08, 2007 1:15 pm    Post subject: STA PHP to Smarty -- can you help me? Reply with quote

I've been using a nifty Split Test Accelerator (STA) for a few years and desperately want to convert the code to Smarty.

I've got most of it licked... except I don't know how to convert this code from PHP to Smarty:

Code:

<?php if ($f[1]==1){echo $code[1];}?>
<?php if ($f[1]==2){echo $code[2];}?>
<?php if ($f[1]==3){echo $code[3];}?>
<?php if ($f[1]==4){echo $code[4];}?>
<?php if ($f[1]==5){echo $code[5];}?>
<?php if ($f[1]==6){echo $code[6];}?>


Can you help me convert this?

Cheers,
Markus Allen
Publisher
http://www.marketing-ideas.org
Back to top
View user's profile Send private message
shannera
Administrator


Joined: 13 Feb 2006
Posts: 802
Location: Edertal, Germany

PostPosted: Mon Jan 08, 2007 1:42 pm    Post subject: Reply with quote

I wonder why you didn't used the following construct in the PHP version, which is far more compacter and easier to maintain than your previous version:

Code:

<?php if (isset(code[$f[1]])){echo $code[$f[1]];}?>


Maybe it is somewhat easier to convert this into Smarty.
Back to top
View user's profile Send private message
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Thu Jan 11, 2007 8:34 am    Post subject: Reply with quote

Code:
{section name=i loop=6}
{if $f[i] == $smarty.section.i.iteration}{$code[i]}{/if}
{/section}
Back to top
View user's profile Send private message Send e-mail Visit poster's website
pcoghlan
Smarty n00b


Joined: 07 Feb 2007
Posts: 2

PostPosted: Wed Feb 07, 2007 4:06 pm    Post subject: Reply with quote

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 -> General 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