Want to send specific values from article to category list

Need help with the Administration of your Joomla! 3.x site? This is the spot for you.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10.
Locked
cdavel
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Fri Apr 18, 2014 12:15 am

Want to send specific values from article to category list

Post by cdavel » Fri Apr 18, 2014 12:34 am

I have a category page that I want to populate a table with information about the articles I am adding to the category. For instance, I have articles of events that I want to list the name, location, and date of the event in a table on the category page.

Is there a way to do this?

Thanks in advance for your help.

Dave

User avatar
rcarey
Joomla! Explorer
Joomla! Explorer
Posts: 471
Joined: Sat Apr 25, 2009 9:20 pm
Location: Minnesota (USA)
Contact:

Re: Want to send specific values from article to category li

Post by rcarey » Fri Apr 18, 2014 2:26 pm

The category's default layout has access to the collection of it's articles, and as long as the information you want to display is within one of the article fields, you can access it.

Override this file: /components/com_content/views/category/tmpl/default_articles.php
(by override, I mean the Joomla way to override it, not to edit this file)

Around link 108 you will find the loop that traverses through each article, and the current article is represented by the variable $article. All the code within this loop outputs the selected data of the article. So you will need to add or change some code within this loop to display what field values you want.

That is the general approach for how you can do this. You will need to understand the php code enough to know where to make the changes and additions.

One more piece of information that might be helpful... Overriding this file will cause all category pages to display however you override this file. If you want only some pages to display with your new format yet retain the original format for other pages, then you ought to copy all the "default" layout files in /components/com_content/views/category/tmpl/, paste the copied files in the overriding directory, and rename the "default" portion of the file names to something different (like "events"). then make your changes on the file events_articles.php. This will create a new type of page (events) that you can select when creating a menu item.
Randy Carey -- as of 2023 I'm mostly retired in web development, but still engaged with a few Joomla projects through
Careytech Studios http://careytech.com custom development for tailored or value-added web solutions


Locked

Return to “Administration Joomla! 3.x”