Log in | Register | Lost password

Bottom
relations in templates - conditional headings
  • Posted: 14.06.2006, 06:48
     
    Converted
    rank:
    12
    registered:
     March 2009
    Status:
    offline
    last visit:
    Posts:
    0
    I looked through the new manual and didn't see this addressed.

    I have a relation between two publications set up and functioning well. However, some records don't have relations established. I have in the template a header describing what the listed relational data is, but the headers display even when the relations aren't entered. So I need to enclose them in a smarty "if". Here's one:

    Code

    <!--[pagesetter_createFilter filter="members:rel:`$core.pid`" assign=f]-->

    <!--[if $f != ""]-->

    <dd>Board Service:

    <!--[pagesetter_inlinePubList tid=6 filter=$f]--></dd>

    <!--[/if]-->


    testing $f != "" is simplistic, but I don't know what else to use. The results must be an array, I guess. How to test the size in smarty?
  • Posted: 14.06.2006, 20:42
     
    Converted
    rank:
    12
    registered:
     March 2009
    Status:
    offline
    last visit:
    Posts:
    0
    if !$f show nothing, else show header.
  • Posted: 15.06.2006, 05:16
     
    Converted
    rank:
    12
    registered:
     March 2009
    Status:
    offline
    last visit:
    Posts:
    0
    I tried:

    Code

    <!--[if !$f]-->

    <!--[else]-->

    <dd>Board Service:

    <!--[pagesetter_inlinePubList tid=6 filter=$f]--></dd>

    <!--[/if]-->


    But it doesn't work. "Board Service" outputs in all circumstances.
  • Posted: 15.06.2006, 12:12
     
    Converted
    rank:
    12
    registered:
     March 2009
    Status:
    offline
    last visit:
    Posts:
    0
    Hi! I have noticed I cannot get if statements to work also. Im using 6.3b3. If I paste the exact code I've got working in 6.2, it will not work. The fields within the if statement get displayed always.
    Any ideas?

    Code

    <!--[ if $meerinfo != "" ]-->

    <tr>

    <th 100%"">

    <div #E9E9E9"">

    <div class="block-title">



    Meer informatie over <!--[$title]-->:

    </div>

    </th>

    <tr valign="top">

    <td 100%">

    <p align="left"> <!--[$meerinfo]--><br>

    </p>

    </td>

    </tr>

    <!--[/if]-->


  • Posted: 20.06.2006, 11:43
     
    Converted
    rank:
    12
    registered:
     March 2009
    Status:
    offline
    last visit:
    Posts:
    0
    OK, I've done some experiments: and if statements do work on integer fields and string fields, but NOT on html fields, at least not with the !="" for 'not empty'. Maybe it is the same with relations?
  • Posted: 26.06.2006, 09:42
     
    Converted
    rank:
    12
    registered:
     March 2009
    Status:
    offline
    last visit:
    Posts:
    0
    The html editor always enters a tag, without having input some so the field is never empty.

    See the solution here:
    http://www.page…ub&tid=4&pid=5



    edited by: moremojo, Jun 26, 2006 - 10:42 AM
  • Posted: 26.06.2006, 11:07
     
    Converted
    rank:
    12
    registered:
     March 2009
    Status:
    offline
    last visit:
    Posts:
    0
    Thanks! that explains why, and this solution will do the trick for me.

    Regards,
    Jeroen

Template courtesy of Designs By Darren.