Component-wide template with MVC

Have a programming question regarding your component, plug-in, extension or core hacks? Have an interesting tidbit, FAQ or programming tip you’d like to share? This is the place for you.

Moderators: tjay, seadap, Rogue4ngel, matthewhayashida

Post Reply
Skippdog
Joomla! Apprentice
Joomla! Apprentice
Posts: 7
Joined: Fri Jan 11, 2008 4:49 pm

Component-wide template with MVC

Post by Skippdog » Fri Feb 08, 2008 8:29 pm

Hi all,

I'm writing a component with several views, but there are several UI elements that are common to all the views. Instead of copying the code into the template of every view, is there a way to make a global template which then will inherit the templates of the view?

Cheers
Last edited by Skippdog on Fri Feb 08, 2008 8:43 pm, edited 1 time in total.

permalink
Joomla! Apprentice
Joomla! Apprentice
Posts: 9
Joined: Tue Feb 19, 2008 5:36 pm

Re: Component-wide template with MVC

Post by permalink » Tue Feb 26, 2008 5:31 am

If I understand what you are saying correctly try this: look in the front end of the com_content component and you will see com_content/views.php defining this class: class ContentView extends JView

Then in the /views directory you will see /article/view.html.php && /category/view.html.php etc.
They all extend ContentView ie. class ContentViewCategory extends ContentView

The admin side exhibits the same concept with even more shared code in the ContentView class.

Hope this helps.


Post Reply