I can create overrides or alternate layouts in template/html/component/ but how can I extend the query based on params in my new layout? How can I extend the model without breaking core?
Maybe I should reword the question. I would like to run a query that gets one article (the first of whichever order I have set in params) of each subcategory.– poproarJul 18, 2014 at 21:17
1Any edits to want to make, simply update your current question. No need to comment below it ;)– LodderJul 18, 2014 at 22:58
Going to be a little more thorough that needed so that people can read this and understand wht you mean by overrides if they have a similar issue.
In your template you should have a HTML Folder
To create a new view for a component (this is the same principal for modules, I will use COM_CONTENT in this example)
- Create a folder called com_content
- Create a folder for the view you want to modify. You can see the list of views by going into (root)/components/com_content/views
In this case let say we want to create an override for article, archive and category - Copy the contents (php view files) of (root)/components/com_content/views/(view)/tmpl into the (template)/html/com_content/(views) - You do NOT need the tmpl folder - php files are the only thing you need to copy to override a view
So Our folder structure of the template will be
I am sure you know but this, but just to clarify
default.php would be the main template file
default_items.php would be a block of the default.php template, likely a seperate view such as a grid
Well done! You now have an override you can alter without worry about an update breaking it and you add whatever new code you want. However you may still have to make some minor alterations to the view.html.php which is generally the thing that generates the variables.
That however is the easy but.. views are simple, but to make a change to the model or controller, you need the help of a third party plugin.
Rather than copy / paste verbatim, I will just link you to the short article that should get you going