More than 800+ satisfied clients and counting, since 2010

Blog

Access Cookie Information From Joomla Article

Access Cookie Information From Joomla Article in 3 Easy Steps

Access Cookie Information From Joomla ArticleThe purpose of accessing cookie information is to display custom messages like, Welcome, [username]. You can easily extract the user’s name using cookies and display it on the front end. Apart from this, you also need to access cookie information from Joomla articles for a number of reasons.

So having said that, the point here is how you can access cookie information from Joomla articles for displaying.

How to Access Cookie Information From Joomla Article?

The only way to access cookie information from Joomla article is through modules. You can’t access the cookie from the article itself. It is because PHP codes cannot be inserted in the Joomla article, it is stripped by the editor.

But you can easily access cookie information from Joomla article by the following way:

  • Create a Module

$user =& JFactory::getUser();

echo ‘Welcome ‘ . $user->name;

  • Add Module in Article

{loadposition myposition}

  • Use Set Cookie

echo ‘Welcome ‘ . JRequest::getString(‘username’, ”, ‘cookie’);

This way you can easily access any cookie information from Joomla articles. If you are facing any problem then request a quote for Joomla module customization.

Written by

The author didnt add any Information to his profile yet