10

In joomla, I need to link every page to a component view. How can I create a page with no component output on it?

Example : On my home page I only want a module output. For this, I can link the home page to an "empty article" but is there a better way to do this without using a third party extension?

  • 2
    Are you using a custom template, or a commercial template? I ask because many of them have an option to shut off the component area completely. – Brian Peat Apr 24 '14 at 12:10
  • @BrianPeat I am using a custom template – web-tiki Apr 24 '14 at 14:56
  • Ah, okay. Well there are several good answers here that should work then :) – Brian Peat Apr 24 '14 at 15:44
  • 2
    Similar question: joomla.stackexchange.com/questions/5056/… – FFrewin Feb 2 '16 at 6:30
15

There isn't really a 'better way' than that.

The only other option is to check whether you're on the homepage in your template file. To check if you're on the homepage you can use the method described on the docs here:

http://docs.joomla.org/How_to_determine_if_the_user_is_viewing_the_front_page

and do something like:

<?php
$menu = JFactory::getApplication()->getMenu();

if ($menu->getActive() != $menu->getDefault()) { ?>
        <jdoc:include type="component" />
<?php } ?>

And that way you never include your component on the home page

  • 1
    A heads up with this method: if you have a link from the homepage that doesn't go to another page, it can appear broken if it loads under the homepage menu item! Watch for any link that is like example.com/component/com_name/view since it would load under the default menu item, and the output of the component would not be displayed. – David Fritsch May 3 '14 at 4:02
  • You might want to add a few more checks to make sure that the current component and view (JFactory::getApplication()->input->get('view')) is also not the same as the menu's view ($menu->getActive()->view) – David Fritsch May 3 '14 at 4:07
  • @DavidFritsch: I think the $menu->getActive()->view, should be $menu->getActive()->query['view']; – FFrewin Aug 24 '14 at 16:54
5

In the JED there's also a "blank" component that lets you publish a menu item so you can place only modules.

http://extensions.joomla.org/extensions/style-a-design/personal-layout/17363

  • I had a problem with this extension, it does not include router.php which causes invalid URLs to not respond with 404. – Flimm Jul 31 '15 at 11:26
4

You can have multiple template layouts in your index file.

<!--Layout 1-->
<?php if ($BConfig->html=='layoutA') : ?>

<jdoc:include type="component" />

<?php endif; ?>  <!--End Layout 1-->

<!--Dynamically Generated Layout 2-->
<?php if ($BConfig->html=='layoutB') : ?>

<jdoc:include type="modules" name="your-module"/>

<?php endif; ?> <!--End Layout 2-->

Then make sure your templateDetails file includes option B. Then in your Joomla! templates, you can set up an additional template using layout b. Go to your home menu item, select that template. The component won't load, but your module will.

2

Stupid, very similar, but fairly easy solution:

  1. Create a article category
  2. Leave it with no content (articles)
  3. Create menu link to it
  4. Assign your modules to that menu link

You might need to turn off some details to be hidden for that category in the category and/or menu item parameters.

  • 1
    This is basicaly the same as using an empty article. – web-tiki Apr 30 '14 at 8:18
1

You can create a empty component. So in com_menus component you can decide with page must not have output just choosing that empty component. In that component, you need create a view and a empty default.php template with the default.xml file, so you will see this option when you are going to choose the component in com_menus component.

1

RocketThemes have a handy feature to hide com_content featured articles.

I use to publish an empty category to minimize the output, and hide it with some CSS styling.

1

Copy the template, remove the jdoc component and assign that style to any menu item not requiring the component.

0

In Joomla! 3.x you can do the following:

  • First create your Modules,
  • Create a new Category, inside a new Article for the main site,
  • Check if you have enabled the Plugin Content - Load Modules

By default Joomla! includes a library called Bootstrap v2.3.2, so you can use the css in this library, for example the grid system: http://getbootstrap.com/2.3.2/scaffolding.html#gridSystem

  • From here, in your article you can see a button called Module, just create a simple or very complex grid and assign your modules to each block.

A benefit that you can get by using this way, is that you can get a template more light with less positions and less php, js and css code, so if you don't need many functionalities, you can create it yourself.

Regards.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.