Sunday 15 September 2013

content management system - List private category in home page (Joomla 2.5) -


My Joomla website has an article category in which all articles are for viewing by registered users only. When I set up a module to list them on my home page, users are shown only when they are logged in. However, I would like to list all the articles in this category, even if the user has not signed in, and when he clicks on the link, he will be asked to present his login data How can this be done?

To work around this, you create a template override for article pages that you want To display articles for all users, the Home Page module will need to make the article public, otherwise they will not show up.

Then you will need to override this file - Component / Com_content / views / article / tmpl / default.php

Make a copy and place it here - template / your template / html / Com_content / article / default.php

If you want to protect all the content, leave the override filename as the default.php. If you only need to protect certain categories, then use a different filename, then in the category Advanced options, select the file that you uploaded from the Alternative Layout dropdown.

In the override, add this code to you:

  & lt ;? Php $ user = & amp; JFactory :: getUser (); If ($ user-> ID):? & Gt; Content you want to preserve here & lt ;? Php else:? & Gt; If the user is not logged in then & amp; Lt; Php endif; ? & Gt;   

This will allow you to leave your articles publicly, but if the user is not logged in to hide the content.

No comments:

Post a Comment