I’m new to Joomla. I need to add a new custom PHP page inside Joomla admin panel (not on the main site) to display some data from my own tables. My Joomla version is 3.4.1 Stable.
2 Answers 2
You might be able to inject a single page to display the data — but I think more than likely your best bet (to do it properly without hacking stuff) might be to develop a small component to handle it best.
By creating the admin component you can create the page you want and display your data however you decide.
If memory serves me correctly, you can create a folder (say com_mycomponent) and create ‘mycomponent.php’ in that directory. Then you add your php code to that page to do whatever you want. Of course, this is for the most basic — barebones idea.
I will expand because to the best of my understanding we will need an installer to actually ‘install’ the component (although it’s been a while since I’ve developed heavily in Joomla). If you don’t create the installer I think it will cause errors within the system.
Create your directory
Create one or two directories in the directory
Create ‘mycomponent.php’ in the admin directory (and site directory if you created one) and write your desired code into the admin file (and/or) site file.
Create ‘mycomponent.xml’ file in com_mycomponent
Open ‘mycomponent.xml’ file and paste the below code
You can remove the following if you did not create the ‘site’ directory:
Zip All the contents under com_mycomponent lets name it com_mycomponent.zip
Login to your joomla admin and install com_mycomponent (the same way you would any extension you download)
This tutorial is going to show you how to add a new page without sidebars to a Joomla! 3.x. based template.
Log into your Joomla! admin panel.
Go to Menus -> Main menu -> Add New Menu Item.
Under the Details tab , click Select in the Menu Item Type * field.
In the window that is going to pop up, click Articles -> Single Article.
Under the Details tab click Select in the Select Article* field.
In the window that is going to pop up, look for the article you want to put on the page the menu item is pointed to and click on it.
Enter the menu name and alias into the corresponding fields, make sure the status is set to ‘published.’
Click on the Menu Assignment tab and save the changes. You will now need to switch off the sidebar modules assigned to the menu by default. You can look for these modules in the list by their positions or by their names. To see the module positions, go to Extensions -> Template Manager -> Options -> Preview Module Positions -> Enabled -> Save.
Click on the Preview icon next to your theme to see the module positions.
The names of the sidebar module positions depend on template numbers, for example aside-right, aside-left, etc.
If any of the modules with these positions is assigned to the menu you created, click on it.
Click on the Menu Assignment tab in the window that is going to pop up, scroll down and look for your new menu in the list (it should be changed so you can see it there).
Uncheck the required page and click Save and Close.
If there are more sidebar modules assigned to your menu, unassign them all.
Click Save at the top left to save the changes.
Open the new page from the front end of your site. It should have no sidebars.
Feel free to check the detailed video tutorial below:
Step #1: Modifying templateDetails.xml
The first step in adding a new module position to your active template is to edit the templateDetails.xml file. This is located under the template folder. Once opened for code editing, locate the
tags. Existing positions will appear similar to the following:
The new position must be added between
tags as they are for the other module positions.
Step #2 (optional step – if gk.const.php file exists)
Second step, Add the new module position to the template module styles by editing the
gk.const.php file located in
Open the .php file and add your new module to the array (see example below). The style for the module may also be set here. In this example it is ‘none’, but it may be something else, such as ‘gk_style’.
A new module position has now been established and it may be selected from module positions in the Joomla admin panel. Lastly, the module must be added to the template.
Step #3: Modifying default.php
Last, very important, step. All template files are located in the layouts folder (
default.php is the default template view, and it contains code blocks located in layouts/blocks. The module may be added directly into the
default.php file or to one of these blocks.
You have to know a little HTML and default template module positions to know where exactly add new module position. See my example, where I showed where to add new module below position “top1” but above “top2”, so between them. Remember about
By the way, using firebug tool (add-on for firefox or chrome browser) should help you understand the structure of each template.
To insert your own (new) module with the condition to show him if only if he is available – paste the following code:
During paste process please connect together second and third line, but must be small space between them. To make the module match the look of the template, you may need to adjust the CSS files, like following (it will add red thin border).