Jump to content

Need help with Smarty/Foreach/Free domains


Recommended Posts

What with template systems in general, and smarty in particular, being a PITA to work with, I'm having an "interesting" time with adjusting step two of the orderform regarding free domains.

 

Despite coding the $freedomaintlds section to be in a fixed width table, the list of TLDs is about 55 screens wide, not 400 pixels ...

 

{if $freedomaintlds}
<table width="400" align="center" border="1">
<tr><th>* [i]{$LANG.orderfreedomainregistration} {$LANG.orderfreedomainappliesto}: [/i]</th></tr>
<tr><td>[i]{$freedomaintlds}[/i]</td></tr>
</table>
{/if}

Is ignoring the table width and making it 100% of the required width for the content - one day someone will invent a computer that actualy does what its bloody-well-told-to-do !

 

Anyway, what I actually want is to control how many tlds on each line, or to check if every tld is there and output a different message etc.

 

So in *theory* ...

 

{$freetlds = explode(",", $freedomaintlds)}
{foreach $freetlds as $freetld}
$freetld - 
{/foreach}

 

should output each of the tlds one at a time with " - " between them - which would be a start. Sadly no output at all.

 

Its the foreach it cant cope with, and I've been staring at it way too long to be able to spot wood-from-trees and see the error, so any pointers much appreciated

Link to comment
Share on other sites

  • 1 year later...

with many thanks to Matt @ WHMCS ...

{if $freedomaintlds}
* <em>{$LANG.orderfreedomainregistration} {$LANG.orderfreedomainappliesto}</em>
<table>
<tr>
{php}
$freedomaintlds = $this->_tpl_vars["freedomaintlds"];
$freedomaintlds = explode(",",$freedomaintlds);
$freedomaintldsbreakat = 13;
foreach($freedomaintlds as $key=>$value)
{
       if ($freedomaintldscounter % $freedomaintldsbreakat  == 0)
       {
               echo "</tr><tr>";
       }
       $freedomaintldscounter++;
       echo "<td>$value</td>";
}
{/php}
</tr>
</table>
{/if}

displays them neatly in a table 13 cells wide - adjust to suit

goes in steptwo and configureproducdomain - just look for the freedomaintlds part :D

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated