Vaclavious Posted November 5, 2008 Share Posted November 5, 2008 hello i need to show this: <div class="orange"> <div id="tkosmo"> <table width="96%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="410px"><?php include "tkosmo.php"; ?></td> <td width="17px"></td> <td width="390px"><?php include "stonudimo.php"; ?></td> </tr> </table> </div> </div> only on my homepage, and hide it while surfing around the site. that code is located in index.php of my template (joomla). two included files are also in template directory. thanks in advance Quote Link to comment https://forums.phpfreaks.com/topic/131428-showing-piece-of-page-only-on-homepage/ Share on other sites More sharing options...
Vince889 Posted November 6, 2008 Share Posted November 6, 2008 Well, what I would do is store: <div class="orange"> <div id="tkosmo"> <table width="96%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="410px"><?php include "tkosmo.php"; ?></td> <td width="17px"></td> <td width="390px"><?php include "stonudimo.php"; ?></td> </tr> </table> </div> </div> into a file. For example, "file.inc.php" And write this into your script: <?php // Checks what page you're on if ($_SERVER['PHP_SELF'] == index.php) { include("file.inc.php") } That should work. I'm NOT an expert, but I really that should work. Quote Link to comment https://forums.phpfreaks.com/topic/131428-showing-piece-of-page-only-on-homepage/#findComment-683812 Share on other sites More sharing options...
auro Posted November 7, 2008 Share Posted November 7, 2008 This should work for you for sure. Please tell me if it does not. <? if ($_SERVER['PHP_SELF'] == "/index.php"){ ?> <div class="orange"> <div id="tkosmo"> <table width="96%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="410px"><?php include "tkosmo.php"; ?></td> <td width="17px"></td> <td width="390px"><?php include "stonudimo.php"; ?></td> </tr> </table> </div> </div> <? } ?> Quote Link to comment https://forums.phpfreaks.com/topic/131428-showing-piece-of-page-only-on-homepage/#findComment-684515 Share on other sites More sharing options...
Vince889 Posted November 7, 2008 Share Posted November 7, 2008 Or "$_SERVER['SCRIPT_FILENAME']" in place of $_SERVER['PHP_SELF']" Like I said, I'm not an expert lol I would have to test it out, but i'm lazy. Quote Link to comment https://forums.phpfreaks.com/topic/131428-showing-piece-of-page-only-on-homepage/#findComment-684827 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.