Page 1 of 1

Component-wide template with MVC

Posted: Fri Feb 08, 2008 8:29 pm
by Skippdog
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

Re: Component-wide template with MVC

Posted: Tue Feb 26, 2008 5:31 am
by permalink
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.