85 Posts
yuberlin
9 years ago
1
Topic

Is it possible to add additional views to a custom template and load them via url?

So letzt say i work with a custom template (seb_minima/position/myContentType/content/mainbody.php) to show my content type in frontend and i want a different view for printing or pdf creation. Something like the component.php in the joomla template path. 

Is it possible to add more views like mainbody.php to my position override and call them like www.mydomain/category/contenttypeview.html?tmpl=customview

???

Get a Book for SEBLOD
85 Posts
yuberlin
9 years ago
0
Level 1

A simple solution for this seems something like this in mainbody.php:

if ($_GET["pdf"]) {
    	include 'pdf.php';
} else if ($_GET["print"]){
    	include 'print.php';
} else {
    	include 'web.php';
}

Then you can load custom content type code for
www.yourdomain.com/category/article.html (regular content type for browser) or
www.yourdomain.com/category/article.html?pdf=1 (load your custom pdf functions) or
www.yourdomain.com/category/article.html?print=1 (load your custom print functions)

If you want to link this views you can use...

$currenturl = JUri::getInstance();
$pdfurl = $currenturl . "&pdf=1";
Get a Book for SEBLOD