Use a different layout for different articles, (single view)

Your code modifications and patches you want to share with others.
Locked
thomasevans08
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Tue Sep 14, 2010 8:08 pm
Contact:

Use a different layout for different articles, (single view)

Post by thomasevans08 » Tue Sep 14, 2010 8:16 pm

Hello I am still fairly new with the Joomla system. I have done a fair amount of reading on how to make custom views via overrides, however I am trying to have two different layouts for an article view for example one being "default.php" and the other being "review.php". I am trying to find a way to have certain articles assigned with a parameter to use the default.php layout and other articles to use the review.php layout I have created.

Would anyone know how to do this?

User avatar
stutteringp0et
Joomla! Ace
Joomla! Ace
Posts: 1388
Joined: Sat Oct 28, 2006 11:16 pm
Location: Texas
Contact:

Re: Use a different layout for different articles, (single v

Post by stutteringp0et » Tue Sep 14, 2010 9:04 pm

Say you have 2 layouts for your view (totally within the parameters of how joomla operates).

The first layout is: default.php and that is the normal article layout.
The second layout is: review.php - you created this one.

When viewing your article in the default view, adding "layout=review" to the URL will display the review.php layout. Even with SEF enabled.

The normal, default layout
http://yoursite.com/articletitle.html

The review layout
http://yoursite.com/articletitle.html?layout=review
My extensions: http://extensions.joomla.org/profile/pr ... ails/18398
Honk if this signature offends you.

thomasevans08
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Tue Sep 14, 2010 8:08 pm
Contact:

Re: Use a different layout for different articles, (single v

Post by thomasevans08 » Tue Sep 14, 2010 9:22 pm

Thank you that information was indeed helpful, this fundamental way of linking does offer me a way of displaying the articles in a different layout.
However I was also wondering if there was a way to create a parameter for the article content that the author could use to select from the two different layouts.

Is that a possibility?

User avatar
stutteringp0et
Joomla! Ace
Joomla! Ace
Posts: 1388
Joined: Sat Oct 28, 2006 11:16 pm
Location: Texas
Contact:

Re: Use a different layout for different articles, (single v

Post by stutteringp0et » Wed Sep 15, 2010 12:06 am

You could build it into your override scripts
My extensions: http://extensions.joomla.org/profile/pr ... ails/18398
Honk if this signature offends you.


Locked

Return to “Core Hacks and Patches”