Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.

×
×
  • 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.