Reputation: 4187
I have a sample file:
/components/com_test/views/test/tmpl/abc.php
And
/components/com_content/views/article/tmpl/default.php
In default.php of com_content
i using code call layout of com_test
...
<?php
require('index.php?option=com_test&view=test&tmpl=component&layout=abc');
?>
...
But result not show layout abc in com_content, how to fix it ?
Upvotes: 2
Views: 2143
Reputation: 3663
You are passing a URL as the parameter for require. That functions expects a path, not a URL.
Instead, you should do this:
<?php
require(JPATH_SITE.DS.'components'.DS.'com_test'.DS.
'views'.DS.'test'.DS.'tmpl'.DS.'abc.php');
?>
Upvotes: 0
Reputation: 4187
I have a ideas is you can using iframe:
JHTML::_('behavior.modal', 'a.modal');
<a class="modal" rel="{handler: 'iframe', size: {x: 500, y: 400}}" href="index.php?option=com_test&view=test&tmpl=component&layout=abc">Test</a>
Upvotes: 1
Reputation: 8178
Haven't dealt with directly in v2.5, but the below code works in Joomla's earlier MVC :
view.html.php
class myComponentViewmyModel extends JView
{
function display($tpl = null)
{
global $mainframe;
if($this->getLayout() == 'abc') {
$this->_displayAbc($tpl);
return;
}
.
.
.
function _displayAbc($tpl)
{
global $mainframe;
.
.
.
}
Upvotes: 2