|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
MarketingJunkie Smarty Regular
Joined: 08 Jan 2007 Posts: 42
|
Posted: Mon Jan 08, 2007 1:15 pm Post subject: STA PHP to Smarty -- can you help me? |
|
|
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 |
|
shannera Administrator
Joined: 13 Feb 2006 Posts: 802 Location: Edertal, Germany
|
Posted: Mon Jan 08, 2007 1:42 pm Post subject: |
|
|
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 |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Thu Jan 11, 2007 8:34 am Post subject: |
|
|
Code: | {section name=i loop=6}
{if $f[i] == $smarty.section.i.iteration}{$code[i]}{/if}
{/section} |
|
|
Back to top |
|
pcoghlan Smarty n00b
Joined: 07 Feb 2007 Posts: 2
|
Posted: Wed Feb 07, 2007 4:06 pm Post subject: |
|
|
|
|
Back to top |
|
|
|
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
|