Fork me on GitHub

Does this pnRender function exist?  Bottom

  • Hi,

    Every so often I wonder if there is a pnRender function that is equivalent to the following PHP code:

    Code

    if (!empty($var))
    {
      do this
    }
    else
    {
      print error
    }


    Anyone know how to do that via a pnRender/Smarty function?

    Thanks,
    Grant
  • I don't see "empty" anywhere in the Smarty documentation, but depending on how you handle the variables you're passing to your template, this should probably work...

    Code

    <!--[if $var ne ""]-->
        <p>This is the HTML if the variable isn't empty.</p>
    <!--[else]-->
        <p>This is your error HTML</p>
    <!--[/if]-->


    For full details, check out the Smarty docs.

    Ed
  • It's been too long, but I the above solution works great. Thanks.
  • 0 users

This list is based on users active over the last 60 minutes.