This site uses cookies and similar technologies.

If you don't change browser settings, you agree to it.

I understand
72 Posts
5 years ago

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 VIP membership
72 Posts
5 years ago
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 (regular content type for browser) or (load your custom pdf functions) or (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