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

Forum closed, please submit your tips and tricks to: http://docs.joomla.org/Category:Tips_and_tricks
Locked
wolfix
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 108
Joined: Tue Dec 06, 2005 5:07 pm

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

Post by wolfix » Mon Jun 23, 2008 3:12 pm

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

wolfix
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 108
Joined: Tue Dec 06, 2005 5:07 pm

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

Post by wolfix » Tue Jul 08, 2008 5:19 am

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

User avatar
leolam
Joomla! Master
Joomla! Master
Posts: 20652
Joined: Mon Aug 29, 2005 10:17 am
Location: Netherlands/ Germany/ S'pore/Bogor/ North America
Contact:

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

Post by leolam » Tue Jul 08, 2008 2:51 pm

we have excellent plugins/mambots who can do this without hacking the index.php

cheers
Leo
Joomla's #1 Professional Services Provider:
#Joomla Professional Support: https://gws-desk.com -
#Joomla Specialized Hosting Solutions: https://gws-host.com -


Locked

Return to “Submit Your Suggested Tips & Tricks to Docs.joomla.org now please.”