MVC View Folder/File setup

Samurai9
Joomla! Explorer
Joomla! Explorer
Posts: 312
Joined: Fri May 23, 2008 3:00 pm
Location: Darkest Afrika
Contact:

MVC View Folder/File setup

Postby Samurai9 » Thu Feb 02, 2012 8:11 pm

Hi Everyone,

My question is:

Is this the only way to setup views as per the eg below

Code: Select all

view1/
   - tmpl/
      - default.php
   - view.html.php

view2/
   - tmpl/
      - default.php
   - view.html.php


or is it possible to have this setup:

Code: Select all

view1/
   - tmpl/
      - default.php
      - someotherview.php
   - view.html.php


i find it a bit tedious having to have a folder embedded in a view folder and 2 files just to render some html and then for another view have exactly the same setup 2 files/2folders...

Thanks folks ^_^

User avatar
gamaza
Joomla! Apprentice
Joomla! Apprentice
Posts: 31
Joined: Mon Mar 07, 2011 5:25 am

Re: MVC View Folder/File setup

Postby gamaza » Sat Feb 11, 2012 6:12 pm

It call layout template.
You can change layout template in your view by add "&layout=someotherview" in your url.

Example "index.php?option=your_component&view=view1&layout=someotherview"
"index.php?option=your_component&view=view1&layout=somethingview"
"index.php?option=your_component&view=hellos&layout=sometimeview"

or type this code in your code

Code: Select all

JRequest::setVar('layout', 'someotherview');


Cheer enjoy with joomla :D


Return to “Joomla! 2.5 Beta Support”

Who is online

Users browsing this forum: No registered users and 1 guest