Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Apr 2009
    Thanked 0 Times in 0 Posts

    if statements in joomla .tpl file

    I would imagine this is the wrong forum for this and I apologize in advance but I didn't know which one to use. I also tried asking this question in the joomla forums but noone had the answer for me. I am using a joomla extension called form2content and the template files must have the extension .tpl I am trying to put an if statement in there to only show certain things at certain times but I can't seem to get it to work properly. I have done tons of research on this and can not find the answer so I was hoping someone might have enough experience with .tpl files to help me out here. Any help would be greatly appreciated. I have tried many things nothing has worked but here is my code right now:

    <mos:tmpl name="root">
    <!--[IF (HORSESIRE != "")]-->
    <p><strong>{HORSENAME}'s Pedigree Information:</strong></p>
    <table cellpadding="0" cellspacing="1" width="75%">
    	  <td rowspan="4" class="maternal">{JOOMLA_TITLE}</td>
    		<td rowspan="2" class="maternal">{HORSESIRE}</td>
    		<td class="maternal">{HORSEGRANDSIRESIRE}</td>
    		<td class="paternal">{HORSEGRANDDAMSIRE}</td>
    	  <td rowspan="2" class="paternal">{HORSEDAM}</td>
    		<td class="maternal">{HORSEGRANDSIREDAM}</td>
    		<td class="paternal">{HORSEGRANDDAMDAM}</td>
    <!--[ELSE IF (HORSEPHOTO1 != "")]-->
    <p><strong>Photos of {HORSENAME}</strong></p>
    <p>Click on any of the images below to view a larger image. When you are done, simply click close to return to this page</p>
    <table class="pics">
    <!--[ELSE IF (FOAL4SALE1PIC != "")]-->
    <p><strong>{HORSENAME} has the following foals which are for sale:</strong></p>
    <table class="pics">
    <td align="center">{FOAL4SALE1PIC}</td>
    <td align="center">{FOAL4SALE2PIC}</td>
    <td align="center">{FOAL4SALE3PIC}</td>
    <td align="center">{FOAL4SALE4PIC}</td>
    <td align="center">{FOAL4SALE5PIC}</td>
    <td align="center">{FOAL4SALE6PIC}</td>
    <td class="caption">{FOAL4SALE1}</td>
    <td class="caption">{FOAL4SALE2}</td>
    <td class="caption">{FOAL4SALE3}</td>
    <td class="caption">{FOAL4SALE4}</td>
    <td class="caption">{FOAL4SALE5}</td>
    <td class="caption">{FOAL4SALE6}</td>
    <td align="center">{FOAL4SALE7PIC}</td>
    <td align="center">{FOAL4SALE8PIC}</td>
    <td align="center">{FOAL4SALE9PIC}</td>
    <td align="center">{FOAL4SALE10PIC}</td>
    <td align="center">{FOAL4SALE11PIC}</td>
    <td align="center">{FOAL4SALE12PIC}</td>
    <td class="caption">{FOAL4SALE7}</td>
    <td class="caption">{FOAL4SALE8}</td>
    <td class="caption">{FOAL4SALE9}</td>
    <td class="caption">{FOAL4SALE10}</td>
    <td class="caption">{FOAL4SALE11}</td>
    <td class="caption">{FOAL4SALE12}</td>

  • #2
    Join Date
    Jul 2010
    Thanked 1 Time in 1 Post
    hi in smarty we will be using like this for the if statements hope this is what you are looking too

    {if $grantname[i] == $grant_idd[i]}
    <input type="checkbox" name="grantname{$smarty.section.i.index}" value="{$grant_idd[i]}" checked="true">{$grantnamed[i]}<br>
    <input type="checkbox" name="grantname{$smarty.section.i.index}" value="{$grant_idd[i]}">{$grantnamed[i]}<br>

    Thanks and Regards


    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts