Jump to content

Recommended Posts

Posted

Hello guys,

I know there is a PHP code for if you are logged in to show certain content. I was looking to see if anyone knows or can create a PHP code that basically does the same thing, but only shows the code if they are on the homepage.

The reason for this is I need to put a script in the header and can't put it in the frontpage_main.tpl template. But I only want this code to be shown and ran on the homepage.

So in a nutshell:

<?php IF ON HOMEPAGE SHOW ?>

Show this -----

<?php ?>

Thanks guys :).

  • Moderators
Posted

Give this a go. This should do the job.

<?php
if(MainController::$activeModule == 'Frontpage')
{
?>
DO STUFF!!! !!!
<?php
}
?>

  • Like 2
Posted

Give this a go. This should do the job.

<?php
if(MainController::$activeModule == 'Frontpage')
{
?>
DO STUFF!!! !!!
<?php
}
?>

Thank you so much, it worked a charm. You're magic :).

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.   Restore formatting

  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.

Loading...
×
×
  • Create New...