how to add &tmpl=component parameter in menu url in Joomla 3 when seo friendy url is set to ON

StackOverflow https://stackoverflow.com/questions/15223563

  •  18-03-2022
  •  | 
  •  

Question

I want to display the article content without template (header, footer, sidebars etc). I just want to display content. I fetching the content using ajax so dont want to display in template.

Was it helpful?

Solution 2

Passing tmpl=component in url renders page without template (header, footer etc) but it still renders

I created custom component_ajax.php compoment file in root of template and passed tmpl=component_ajax in ajax request. In component_ajax.php removed all parts which are not needed and kept only . Removed all other html tags. So what i get in ajax response is the content only.

OTHER TIPS

Since your users may be using some custom extensions to handle SEF, it's best when you make ajax calls NOT to go through JRoute to generate the link, this will leave all the parameters clear.

If this is not an option, and you don't want your template to render, you can issue an exit command at the end of your view's display method, this will stop template processing and obtain a similar result as tmpl=component, it just won't include headers most likely.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top