I am using lithium framework to do my application because it supports mongodb ,
Now I am trouble with how to include another view file in a view file
For example I get a view file named 'menu.html.php'
<div id='menu'>
<ul>
<li>home</li><li>about</li><li>contact</li>
</ul>
</div>
In my 'index.html.php' ,I want to inlude the above file so that I don't have to write the same code each time. So that's my solution
<?php
$base = ($_SERVER['DOCUMENT_ROOT']);
echo $this->render($base.'/app/views/meeting/mainmenu.html.php');
?>
I think there must be a better way to do that.Because every time I need to calculate the full view path.
I haven't yet find the answer in lithium's doc. Any helps would be thanks
You can use this in your view files to render elements:
<?= $this->_render('element', 'resources/list-single', compact('resource')); ?>
Will render the file 'app/views/elements/resources/list-single.html.php'. $resource will also be available in the sub-template.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.