Showing posts with label JURI. Show all posts
Showing posts with label JURI. Show all posts

Wednesday, January 30, 2013

How to get the view and layout in Joomla 2.5

In Joomla 2.5 if you want to know the requested uri :
 $uri =& JURI::getInstance(); echo 'Request URI is ' . $uri->toString() . "\n"; 
And for the view and layout you can do the following :
echo (JRequest::getCmd('view')) ."Is the View"; 

echo( JRequest::getCmd('layout'))."Is the Layout"; exit;  
Why is that ? Because Joomla 2.5 using SEF routing that changes the requested route to a new segments related to your category's id and name as well as to the article's id and alias . Which will leads you to no where if you programming a joomla module and need to extract the coming request to check the required view and layout.