<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="FeedCreator 1.7.3" -->
<rss version="2.0">
	<channel>
		<title>How to determine which page you are on from within a Joomla! 1.5 template</title>
		<description>Comments for How to determine which page you are on from within a Joomla! 1.5 template at http://www.howtojoomla.net , comment 1 to 23 out of 20 comments</description>
		<link>http://www.howtojoomla.net</link>
		<lastBuildDate>Sun, 21 Mar 2010 17:17:52 +0100</lastBuildDate>
        <generator>FeedCreator 1.7.3</generator>
		<item>
			<title>getInt instead getVar for any id</title>
			<link>http://www.howtojoomla.net/2008041785/how-tos/templates/how-to-determine-which-page-you-are-on-from-within-a-joomla-15-template#comment-2022</link>
			<description>Hi!!

Someone said:

$myitemid = JRequest::getVar('Itemid',''); 

You must use getInt('Itemid','') instead of getVar or you can have a security problem. - Juan</description>
			<pubDate>Tue, 23 Feb 2010 04:57:14 +0100</pubDate>
		</item>
		<item>
			<title>Finally</title>
			<link>http://www.howtojoomla.net/2008041785/how-tos/templates/how-to-determine-which-page-you-are-on-from-within-a-joomla-15-template#comment-1491</link>
			<description>I used the code on here to figure out a solution.  Basically, after some minor mods by me, the above helped me be able to hide things on every other page except the homepage.  I love you guys!  It took me over 5 hours to figure this out!  I scourged all over the forums, and looked high and low, and no one knew anything.  Thanks a bunch, you guys are geniuses!

I hope this code can help others that may need this...and saves them time.
I put this at the top of my index page:



I put this in the body of my code:


some stuff here.

some stuff here.



 - Elkin</description>
			<pubDate>Tue, 05 May 2009 21:12:42 +0100</pubDate>
		</item>
		<item>
			<title>...</title>
			<link>http://www.howtojoomla.net/2008041785/how-tos/templates/how-to-determine-which-page-you-are-on-from-within-a-joomla-15-template#comment-1401</link>
			<description>Good tip, Luke. I prefer to use Itemid, because there are no duplicates. You get the Itemid like this:

$myitemid = JRequest::getVar('Itemid',''); - Cory</description>
			<pubDate>Mon, 16 Mar 2009 09:19:49 +0100</pubDate>
		</item>
		<item>
			<title>Check for active menu</title>
			<link>http://www.howtojoomla.net/2008041785/how-tos/templates/how-to-determine-which-page-you-are-on-from-within-a-joomla-15-template#comment-1400</link>
			<description>In the template file I use the following if I need to alter the template depending on the current menu item name. Not sure how well it will scale if you have menu items with the same name, but works ok for small sites.

$menu = &amp;JSite::getMenu();
$activeMenu = $menu-&gt;getActive();
$activeMenuName = $activeMenu-&gt;name;

if ($activeMenuName==&quot;somepage&quot;){
do something
}
 - luke</description>
			<pubDate>Mon, 16 Mar 2009 07:52:17 +0100</pubDate>
		</item>
		<item>
			<title>...</title>
			<link>http://www.howtojoomla.net/2008041785/how-tos/templates/how-to-determine-which-page-you-are-on-from-within-a-joomla-15-template#comment-1257</link>
			<description>I find it simpler to put everything into the php if statement like this:
[quote][/quote]
Then you can change the getVar to whatever you want without creating a new variable every time.
 - Dan Walker</description>
			<pubDate>Thu, 08 Jan 2009 06:33:36 +0100</pubDate>
		</item>
		<item>
			<title>...</title>
			<link>http://www.howtojoomla.net/2008041785/how-tos/templates/how-to-determine-which-page-you-are-on-from-within-a-joomla-15-template#comment-1219</link>
			<description>Hi Christian,

You can extend this technique further using JRequest::getVar and other variables passed in through the URL. For example, the &quot;page&quot; variable in Virtuemart might be very useful to you, so you could something like

[quote]
$vmpage = JRequest::getVar('page','');
[/quote]

and then

[quote]
if ($vmpage == 'somepagevalue') {
  // perform some function
}
[/quote] - Cory Webb</description>
			<pubDate>Mon, 15 Dec 2008 14:11:10 +0100</pubDate>
		</item>
		<item>
			<title>...</title>
			<link>http://www.howtojoomla.net/2008041785/how-tos/templates/how-to-determine-which-page-you-are-on-from-within-a-joomla-15-template#comment-1218</link>
			<description>Can't get this to work... probably because I have VirtueMart as frontpage as well. Any ideas there?

/Chris - Christian Skauge</description>
			<pubDate>Mon, 15 Dec 2008 14:06:35 +0100</pubDate>
		</item>
		<item>
			<title>...</title>
			<link>http://www.howtojoomla.net/2008041785/how-tos/templates/how-to-determine-which-page-you-are-on-from-within-a-joomla-15-template#comment-1160</link>
			<description>Wow, Cory this is what i was looking for!
i wanted the value for $view and $option but when SEF was turned ON
my whole template was GONE wild :-), as i was getting values from the URL... but thanks for your tips regrading JRequest!

Mohsin - Mohsin</description>
			<pubDate>Fri, 21 Nov 2008 02:23:57 +0100</pubDate>
		</item>
		<item>
			<title>...</title>
			<link>http://www.howtojoomla.net/2008041785/how-tos/templates/how-to-determine-which-page-you-are-on-from-within-a-joomla-15-template#comment-1069</link>
			<description>Hi Doug... you would use mosGetParam instead of JRequest::getVar. You can read more about mosGetParam here: http://help.joomla.org/content/view/516/155/ - Cory</description>
			<pubDate>Tue, 28 Oct 2008 16:52:55 +0100</pubDate>
		</item>
		<item>
			<title>...</title>
			<link>http://www.howtojoomla.net/2008041785/how-tos/templates/how-to-determine-which-page-you-are-on-from-within-a-joomla-15-template#comment-1068</link>
			<description>How do you do this technique in 1.0? I'm having a hard time finding documentation on the 1.0 template API. If you have a link for docs, that'd be awesome, too!

Thanks! - Doug</description>
			<pubDate>Tue, 28 Oct 2008 16:49:07 +0100</pubDate>
		</item>
		<item>
			<title>...</title>
			<link>http://www.howtojoomla.net/2008041785/how-tos/templates/how-to-determine-which-page-you-are-on-from-within-a-joomla-15-template#comment-968</link>
			<description>Thank you so much for this suggestion and sharing your knowledge. A real timesaver!

Cheers,
Sam - Sam</description>
			<pubDate>Mon, 18 Aug 2008 08:16:58 +0100</pubDate>
		</item>
		<item>
			<title>...</title>
			<link>http://www.howtojoomla.net/2008041785/how-tos/templates/how-to-determine-which-page-you-are-on-from-within-a-joomla-15-template#comment-921</link>
			<description>Hi,

I want a set of articles (not all articles) to have a different headers (h1, h2 etc. ).

Is there a clever to change the template within the article component?

Or should I better crate a copy of the component? (If so, do you know which?)

Thanks in advance,
Gijs - Gijs</description>
			<pubDate>Fri, 18 Jul 2008 12:53:49 +0100</pubDate>
		</item>
		<item>
			<title>...</title>
			<link>http://www.howtojoomla.net/2008041785/how-tos/templates/how-to-determine-which-page-you-are-on-from-within-a-joomla-15-template#comment-905</link>
			<description>Hey, just found what I was looking for. Thanks a lot buddy! Keep up the good work. - jairp heinrich</description>
			<pubDate>Wed, 09 Jul 2008 15:41:49 +0100</pubDate>
		</item>
		<item>
			<title>...</title>
			<link>http://www.howtojoomla.net/2008041785/how-tos/templates/how-to-determine-which-page-you-are-on-from-within-a-joomla-15-template#comment-886</link>
			<description>Great question, Zee. My answer to that is, it depends on the situation. Sometimes you just need a small modification based on which page you are on. Making a separate template is a lot of work for a small modification when you can easily use this technique to make that modification within the same template.

Also, when you are dealing with multiple templates and you need to make a style change, you have to do it in more than one place. Keeping it all within one template limits the need to make changes in several places.

Thanks for the question, and thanks for visiting! - Cory</description>
			<pubDate>Wed, 02 Jul 2008 23:50:42 +0100</pubDate>
		</item>
		<item>
			<title>...</title>
			<link>http://www.howtojoomla.net/2008041785/how-tos/templates/how-to-determine-which-page-you-are-on-from-within-a-joomla-15-template#comment-885</link>
			<description>As another option, couldn't you create another template and tell the menu item which template to use?  Or do you find the method above easier? - Zee</description>
			<pubDate>Wed, 02 Jul 2008 23:39:28 +0100</pubDate>
		</item>
		<item>
			<title>...</title>
			<link>http://www.howtojoomla.net/2008041785/how-tos/templates/how-to-determine-which-page-you-are-on-from-within-a-joomla-15-template#comment-810</link>
			<description>Just a simple question, how do you add the colors in your articles for php coding for example, and how you format it like that? - Fernando</description>
			<pubDate>Tue, 27 May 2008 04:20:46 +0100</pubDate>
		</item>
		<item>
			<title>...</title>
			<link>http://www.howtojoomla.net/2008041785/how-tos/templates/how-to-determine-which-page-you-are-on-from-within-a-joomla-15-template#comment-809</link>
			<description>On top of page : 
[? $pageoption = JRequest::getVar( 'option', '' ); ?]
[? $pageview = JRequest::getVar( 'view', '' ); ?]

On body : 
[? if ($pageoption == 'com_virtuemart') {echo &quot;&quot;;}
   elseif ($pageview == 'article') {echo &quot;&quot;;} 
       else { ?]
       
    [ } ?]

* change [ ] to &lt; &gt; - links</description>
			<pubDate>Sun, 25 May 2008 01:05:07 +0100</pubDate>
		</item>
		<item>
			<title>...</title>
			<link>http://www.howtojoomla.net/2008041785/how-tos/templates/how-to-determine-which-page-you-are-on-from-within-a-joomla-15-template#comment-808</link>
			<description>uh sorry, i think i need to quote my code :
On top of page : 
[quote]


[/quote]
On body : 
[quote]

       
    
[/quote] - links</description>
			<pubDate>Sun, 25 May 2008 01:01:38 +0100</pubDate>
		</item>
		<item>
			<title>...</title>
			<link>http://www.howtojoomla.net/2008041785/how-tos/templates/how-to-determine-which-page-you-are-on-from-within-a-joomla-15-template#comment-807</link>
			<description>this simple article is life safer !, i search all day in jm and vm forum but can't found this solution, one question : is my php right if need to hide from several component :

On top of page :



On body :

       
 - links</description>
			<pubDate>Sun, 25 May 2008 00:59:36 +0100</pubDate>
		</item>
		<item>
			<title>...</title>
			<link>http://www.howtojoomla.net/2008041785/how-tos/templates/how-to-determine-which-page-you-are-on-from-within-a-joomla-15-template#comment-800</link>
			<description>Hi Lisa... this should work with SEF URL's because you are using Joomla's &quot;JRequest::getVar&quot; command. I could go into a lengthy explanation of why this works, but basically Joomla automatically knows what the request parameters are even if you use SEF URL's. - Cory</description>
			<pubDate>Mon, 19 May 2008 07:30:31 +0100</pubDate>
		</item>
	</channel>
</rss>
