By default, joomla looks for the layout
keyword in the URL to decide which layout to display. If this variable is empty or not present then the tmpl/default.php
layout will be loaded.
By editting your view.html.php
file you can set the default layout by using the JView API, e.g. $this->setLayout('lol')
will make the URL example.com/yourview
equivalent to example.com/yourview?layout=lol
.
However, this change alone will result in Joomla overriding it's default behaviour so that the layout
request will be ignored. This means that the request example.com/yourview?layout=lmao
will also display example.com/yourview
= example.com/yourview?layout=lol
You can solve this easily by adding a condition around the setLayout
function so that only if the layout
keyword is not present then you will set the default layout to lol
, e.g.
<?php
# ...
function display($tpl = null) {
# ...
# Edit : Set the default layout to 'lol'
$layout = JRequest::getWord('layout', '');
if (empty($layout)) $this->setLayout("lol");
// Display the view
parent::display($tpl);
}
# ...