Adding views/tmpl to Joomla Plugin -
i need advice on how add together different views/tmpls joomla 3.x scheme plugin. made simple plugin replace joomla 3.x offline page, add together several different views (layouts) plugin. confused views vs tmpl. 1 give me guidance , give me simple directory construction follow.
i utilize code trigger \views\defaultview\view.html.php want have more different views. right way?
public function onbeforerender(){ // application. $app = jfactory::getapplication('site'); if (($app->getcfg('offline'))&&(!$app->isadmin())) { // document object. $doc = jfactory::getdocument(); $view = 'defaultview'; $basepath = __dir__; $config = array( 'base_path'=>$basepath); require_once $basepath . ds . 'views' . ds . $view . ds . 'view.html.php'; jresponse::setheader('content-type', 'text/html; charset=utf-8'); jresponse::sendheaders(); $app->close(); } } thanks. regards.
you don't provide much info (e.g. joomla version, code showing you've tried etc) here goes…
views , tmpls part of mvc of joomla components not plugins. plugins little pieces of code respond events. if you're not clear on them read linked articles.
having, said that, possible impact loading of view or it's tmpl how want utilize depend on existing code. depending on whether you're on joomla 3.x or joomla 2.5.x benefit reading through tutorials developing mvc component, 2.5.x version here or 3.x version here.
tmpl files templated pieces of code loaded view, tmpl file can load sub-tmpl file easily. e.g. /tmpl/default.php can load /tmpl/default-tools.php single phone call (originally meant flexible , reusable pieces of code various reasons doesn't work in practice). can overridden template in utilize given page.
in recent releases of j3 line, layouts available. these are small, flexible pieces of code can used , re-used in various places through-out joomla, , can provided third-party extensions, , overridden @ template.
if can provide more details particular usage scenario, code etc can provide more help.
failing question joomla specific implementation details, may improve result if you, seek asking on the joomla q&a stackexhange site.
joomla
No comments:
Post a Comment