Jump to content

Showing piece of page only on homepage


Vaclavious

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/131428-showing-piece-of-page-only-on-homepage/
Share on other sites

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.

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>
<?
}
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.