Domanda

I currently edit one template of WHMCS, it's written by Smarty.

Can I use something simple like

{if $is_homepage}
    show something
{/if}

Which homepage is loaded from homepage.tpl, mean index page. Because I want to load some code, just in homepage only. Thanks.

È stato utile?

Soluzione

quite hacky but you might try something like this:

{if ($smarty.server.SCRIPT_NAME eq "/index.php")}

{/if}

Altri suggerimenti

Use this instead if you desire optimized code.

{if $filename eq "index"} 
your code here 
{/if}  

you don't have to include the filename extension like .tpl (just in case you were wondering)

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top