Jump to content

Need a tag that recognizes the homepage.


peeta

Recommended Posts

I want to use a javascript to open a div popup on the homepage only. The div and the initialization script are in footer.tpl so it tries to execute on all pages.

 

I need something like this

 

{if is_homepage}

show this

{/if}

 

Can anyone guide me on this? Thanks

Link to comment
Share on other sites

I use that now but I have a long title 'Turnkey Webhost with free website template and E-commerce package' which is subject to change so I wanted something which could identify just the home page. Is it not possible?

Link to comment
Share on other sites

You can use the javascript window.location function:

 

if(window.location == "index.php"){

 

}

 

Although I'm not sure if this will work with the query strings.

 

You could always put the code in the template file for the homepage only?

 

Ben

Link to comment
Share on other sites

baji26 already suggested that method and I explained why I didn't want to use it. If it remains the only method then I have no choice but I'd rather something else. My entire website is WHMCS so the home page title is quite long (something to do with SEO).

 

Maybe if there was an editable file in the root called homepage.php then I could possibly assign a variable like $smarty->assign('homepg', $true); and then use {if $homepg}stuff{/if}

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated