Page 1 of 1

HOW TO: Show PHP and/or HTML code on select pages.

Posted: Mon Jun 23, 2008 3:12 pm
by wolfix
Here's an example:

Code: Select all

<!-- If someone goes to any of these pages, show the html and/or php code. -->
<?php 
	if ($_SERVER['REQUEST_URI'] == '/' or
	    $_SERVER['REQUEST_URI'] == '/index.php' or 
	    $_SERVER['REQUEST_URI'] == '/index.php?option=com_content&view=frontpage&Itemid=1' or
	    $_SERVER['REQUEST_URI'] == '/home-mainmenu-1.html') 
      { ?>

		    (Put html, css or more php code here)
                (Be sure to use beginning and ending php tags for embedded php code:)
                    example: <?php (more php code here) ?>

<?php } ?>
I tried to make the code look pretty but it's hard to do when posting...

Best,

wolfix

Re: HOW TO: Show PHP and/or HTML code on select pages.

Posted: Tue Jul 08, 2008 5:19 am
by wolfix
I forgot to mention that you should put this code in your index.php file of your template.

You can wrap any section of the template with the code.

Best,

wolfix

Re: HOW TO: Show PHP and/or HTML code on select pages.

Posted: Tue Jul 08, 2008 2:51 pm
by leolam
we have excellent plugins/mambots who can do this without hacking the index.php

cheers
Leo