Kian Posted September 11, 2012 Share Posted September 11, 2012 Hi all This is a part of my clientareaproducts.tpl (the page where customers can view the list of all their services) {foreach key=num item=service from=$services} <tr class="clientareatable{$service.class}"> <td>{$service.group} - {$service.product}{if $service.domain}<br /><a href="http://{$service.domain}" target="_blank">{$service.domain}</a>{/if}</td> <td>{$service.amount}</td><td>{$service.billingcycle}</td><td>{$service.nextduedate}</td> <td> <form method="post" action="{$smarty.server.PHP_SELF}?action=productdetails"> <input type="hidden" name="id" value="{$service.id}" /> <input type="submit" value="{$LANG.clientareaviewdetails}" class="button" style="margin:0" /> </form> </td> </tr> {foreachelse} <tr class="clientareatableactive"> <td colspan="6">{$LANG.norecordsfound}</td> </tr> {/foreach} We all know what it does. For each service it displays a row with product name, registration date, expiration date, "view details" button. If there's no service it displays "No record found". Ok now all i want to do is add a new display rule. I want to hide from this list all services with a specific $pid basically something like... {if $pid eq "50"}<tr style="visibility: hidden"></tr>{/if} I tryed with several "foreach" format with no success. The question is: how can i exclude from the foreach cycle a service with a specific pid or at least how can i identify it to hide its row with css? 0 Quote Link to comment Share on other sites More sharing options...
Kian Posted September 13, 2012 Author Share Posted September 13, 2012 I know that it could be made with Smarty {foreach}{continue} but i can't get it to work. i tryed to integrate this example with the code above with no success. {$data = [1,2,3,4,5]} {foreach $data as $value} {if $value == 3} {* skip this iteration *} {continue} {/if} {$value} {/foreach} {* prints: 1 2 4 5 *} Any idea? 0 Quote Link to comment Share on other sites More sharing options...
jclarke Posted September 13, 2012 Share Posted September 13, 2012 The pid isn't available from this page, so you would need to hide instead based on the product name or you need to make a database call to determine the pid and then hide based on the results. If you add {debug} to the top of this template, it will show you exactly what variables are available. 0 Quote Link to comment Share on other sites More sharing options...
Kian Posted September 14, 2012 Author Share Posted September 14, 2012 I forgot to type $service.server.id instead of $pid that isn't available in clientareaproducts.tpl. Anyway i finally solved it thanks to Tews of Smarty. I was trying to use {continue} function that doesn't work with WHMCS's Smarty version. Solved with a simple if (no continue/break is involved). Thank you anyway 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.