Friday, April 27, 2012

Some Important syntax of Joomla

Here are the some codes to help the joomla developer..


login user details 


$user =& JFactory::getUser();
echo $user->id;
echo $user->username;
echo $user->name;
echo $user->email;
echo $user->usertype;
echo $user->guest;
echo $user->get('aid'); // access Guest 0, register 1



Check the user is guest or registered


$user = & JFactory::getUser();

if($user->get('guest'))
      echo"login";
else
     echo"logout";


Check page status is home page or not..


if ($menu->getActive() == $menu->getDefault()) {
    echo "Default page";
} else
    echo "Inner page";
}

Setup page title suffix or prefix in pages.


$title = $this->getTitle();
$this->setTitle('Prefix - ' . $this->getTitle().'-  suffix ');


Cheers....

2 comments: