Drupal: .htaccess Access Deny
August 21, 2014 – 7:59 am | No Comment

In this article I will tell how to forbid access to certain resources for some clients. The instructions will include descriptions of different directives.

Read the full story »
CSS Templates

Contain reviews and news about CSS Templates.

Freebies

Contain freebies such as icons, graphics, headers and images for your websites.

Fun Stuff

Contains other fun stuff for entertainment or interesting site showcase.

How-To

Contain technical elaborations on some specific workarounds or common tweak.

Joomla Templates

Contains reviews and news about Joomla templates.

Home » How-To

How to Display Content and Nothing Else on the Page of Your Joomla Site

Submitted by on November 12, 2009 – 9:27 amNo Comment

Sometimes you may need to display your content on a blank page or to see a component’s output and nothing else on a page. In this article I would like to share my experience of how you can do that with Joomla.


How it works

If you view files structure of distribution disk, you’ll find two files in Joomla root: index.php and index2.php. It may appear strange that Joomla has two files with similar names. But these files perform almost similar functions with the only difference. The main goal of the files is to call a component to be executed. In addition, index.php executes a template, i.e. loads all modules that were specified for the page, and shows the page to a user. Index2.php knows nothing about modules and executes just calling of the component.

So, index.php and index2.php are entry points for execution of any user request. However, user is able to request individual files of your applications directly if it is necessary. But the standard method to call a component includes using of the address bar of your browser using the following structure

index.php?option=com_component

where option variable is a name of the component (or more exactly name of a folder with the component) installed in Joomla.

If you need to display some content (or component) without any other modules and/or templates, you should link it as

index2.php?option=com_component

This also works for Joomla administrative area, so you can display a custom component and nothing else on the page (see the last section of this article).

Why do you need that?

Actually this is widespread problem. For example, you may need to show a printable version of a page. It is necessary to display content of the page to be printed and nothing else in this case.

Or you may need to show some image (for example, captcha image) to a user who enter data to the form. In this case the proper form should be displayed in a usual way through index.php. Specifying the following path to the image:

http://site.com /index2.php?option=com_component&task=generate_image&no_html=1

you will get to your component but hanks to no_html parameter nothing except the image will be displayed there. Using of index.php in this call would display a template in addition.

This treatment to the component can be also useful in AJAX-application when you need to send a request and its response contains some XML data and nothing else at all.

Custom component output in Joomla administrative area

What should you do to see a component’s output and nothing else in Joomla administrative area? It’s pretty simple, just follow these steps:

  • Create a menu item that links to your component.
  • Once you have created your menu item, click on that menu item in your Menu Manager like you were going to edit the menu item.
  • Next to "URL", you should see something like "index.php?option=com_yourcomponent&…". Copy that URL.
  • In the browser address bar, type the domain name and path to your website along with the URL information you copied in the previous step.
  • Change "index.php" to "index2.php", and voila! You are now looking at just your component’s output.

This will allow you to better debug the HTML that was coming from the component.

Good luck and see you again!

Leave a comment!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.