Joomla 2.5.8. How to display only article or module content in modal box popup.

6.8k Views Asked by At

I want to put login module in to modal popup. But when I use class="modal" whole page gets loaded in to modal. Can you show me the way to put only module.

This stands also for displaying articles in modal.

here is the link with problem

3

There are 3 best solutions below

0
On

I do this fairly often and there are two tricks that can help make this work better. First you will likely want to add tmpl=component to your url. This causes Joomla to only display the article instead of the entire template (as long as your template supports this, most do).

This should do pretty well. If you want to get even more selective, you can do one of two things:

Add CSS to hide pieces

.modal-body .other-selector {
    display:none;
}

Use Javascript to select only the piece that you want

$('#myModal').on('show', function () {
  // selects a piece of the current modal body and sets it as the only content of the modal
  $('#myModal .modal-body').html($('#myModal .modal-body').find('.other-selector).html());
})
0
On

The way you can only display the component is to add an extra parameter tmpl=component in the url.If you'll see the component.php inside your template folder that has mainly <jdoc:include type="component" /> with no module position.So it'll load only component.

I did not try for module but you can try similar for module.So you can try it by just giving the position of the module in whole template like create a new page called modules.php in your template folder and put the module position inside this page.And you call it in a similar way just like component like tmpl=modules

I hope this will work.

0
On

It was problem with my templates component.php file. I just added inside and now it works fine. Thanks guys