2

I have developed a Joomla module that does provides a form, processes its post data, does some calculations and displays the results.

The module includes a button to print the results. I'm currently using JavaScript to open a new window, paste the relevant HTML and open the print dialog.

Instead of JavaScript I would prefer to provide a separate URL for the print view and simply open that in a _blank target. This would make the application work better for people using screen readers or not having JavaScript available.

Is there any way that I can tell Joomla to not render the template along with my module? I was thinking that creating a component fixes that issue, but had to find that components are rendered into the template, too...

BTW: I have Joomla 1.5.22

chiccodoro
  • 14,407
  • 19
  • 87
  • 130

2 Answers2

4

To achieve what you want you have to add additional tmpl=component query string parameter to the request URL. This will disable template and module rendering.

Your URL will look something like this: index.php?option=com_xxx&view=xxx&tmpl=component

Since you are using Joomla 1.5 you can request index2.php?option=com_xxx&view=xxx and it will only render the component. Joomla 2.5 does not have index2.php so if you plan to migrate in future, don't use this option.

If you are using SEF then adding ?tmpl=component at the end on URL does the trick.


To go a step deeper... in your template directory you have component.php file, that is the file that's being loaded by tmpl param. You can copy component.php to my_component.php, do necessary changes and load your custom component template with index.php?option=com_xxx&view=xxx&tmpl=my_component
Alex
  • 6,441
  • 2
  • 25
  • 26
0

The joomla way of doing it would be to set your output to "raw", see this tut:

http://www.katcode.com/displaying-raw-output-in-joomla-by-setting-format-in-the-component/

seavers
  • 551
  • 5
  • 16
  • that's an option too but `format= raw` only returns component response without proper html wrapping. It's good to use in ajax calls, but not for displaying at frontend. – Alex Apr 20 '12 at 19:16