25
votes
Accepted
How to check what component is being used on current page?
For Joomla 3.x
While the code from the other answer will work, JRequest is deprecated, therefore you should use the following:
$jinput = JFactory::getApplication()->input;
echo $jinput->get('...
20
votes
Accepted
How to get Itemid by URL and pass it to JRoute
Here is a technique I used (cannot remember where I found it).
$app = JFactory::getApplication();
$menu = $app->getMenu();
$menuItem = $menu->getItems( 'link', 'index.php?option=com_example&...
18
votes
Accepted
Where is $this->baseurl defined in joomla?
$this->baseurl; is basically the shortcut for JUri::base(). It gets the URL you have specified as the live_site variable in your configuration.php file. If this has no value, then it will use some ...
17
votes
Accepted
How to develop a Joomla module?
Learning Joomla Module Development
The way I learned, was by studying and customizing the core or other 3rd party modules.
Modules as concept are simpler than the components (which we could say are 2 ...
16
votes
Accepted
How can I programmatically get the Joomla database prefix using php?
You can get the prefix using the following:
For Joomla 2.5 use:
$app = JFactory::getApplication();
$prefix = $app->getCfg('dbprefix');
For Joomla 3.2 use:
$app = JFactory::getApplication();
$...
16
votes
How to get joomla version by http?
Ok so this is what I was writing yesterday.
For Joomla 2.5 and 3.x only
Check if the http:// prefix is missing from the URL. If it is, then it adds it. Note that In this case I have not taken https://...
15
votes
Accepted
Joomla Component Tool or Scaffold?
One tool that I've used in the past is Component Creator: http://www.component-creator.com/en/.
This tool allows you to outline one table for free (more if you sign up for a paid package) as well as ...
15
votes
How to develop a Joomla module?
Have you seen the following tutorials in the joomla documentation?
http://docs.joomla.org/J2.5:Creating_a_simple_module
http://docs.joomla.org/J3.3:Creating_a_simple_module
In particular, make sure ...
15
votes
Accepted
Adding custom CSS styling on some of my pages
There are several ways to add custom CSS code to a specific page. Here's a couple of alternatives:
Alt. 1 - Page class
Use page classes. In the menu item editor, under the "Page display" tab, there's ...
15
votes
How to stop (fake) users from registering on my website?
Why I find fake/spam registered users in my site…?
The majority of such registrations are coming from botnets, infected machines, script kiddys and generally all kind of bots.
In systems like Joomla, ...
14
votes
Accepted
Joomla tmp directory - What is it for and can I delete its content?
You can definitely delete the files in the tmp directory and actually it is strongly recommended to do so and maintain it clean.
You should only keep the index.html file in place, that may prevent ...
13
votes
Best method to check if a component is installed/enabled?
I use this way:
// Check for component
if (!JComponentHelper::getComponent('<component name>', true)->enabled)
{
.....
}
<component name> - without "com_" prefix
13
votes
Catching exception/error in database transaction
JError has been deprecated in J3.x, in favour of PHP exceptions, as it intermixed 2 different programming concepts: logging and error handling (the logging side has now been implemented as JLog).
For ...
12
votes
Adding joomla's default toolbar in a component view page
The best practice is to create the addToolBar() method inside your View class and then using JToolBarHelper class to create command buttons:
protected function addToolBar()
{
JToolBarHelper::addNew(...
12
votes
Migrating component from 2.5 to 3.3
Even the link you have provided in your question does not provide everything single thing that need to be change when migrating an extension. There are always fairly big API differences between each ...
11
votes
Accepted
Upgrade from 2.5 to 3.x overview
"one click" upgrade works very well for Joomla! 2.5 Core.
But your site may have several templates or extensions to be also upgraded.
I'm also planning a "June" migration of our main site. This is ...
11
votes
How to allow registered users on offline site
To control what user groups have access to an offline site, go to Global Configuration (System -> Global Configuration) and select the Permissions tab. Select the user group you want to give access on ...
11
votes
Accepted
How to stop (fake) users from registering on my website?
Newer versions of Joomla 3.x disable User Registration by default.
If your version of Joomla was installed before this change, you probably have User Registration enabled.
User Registration can be ...
10
votes
Accepted
Understanding CSS classes applied to menus: "deeper" and "parent"
.deeper is applied when the menu item has a submenu (item)
.parent is applied if this menu item is parent of another menu item
If you have a menu showing all levels then both classes are applied to a ...
10
votes
Accepted
How to display module in component area
I have done this by creating a module position at the same location with the component and checking if a module is present at this position then display it, otherwise go for the component:
Code ...
10
votes
How to display module in component area
To enhance the given answers here:
To include a modul position in your component view and to load modules there, you just have to add
echo JHtml::_('content.prepare', '{loadposition ...
10
votes
Is it possible to redirect a admin user to a specific component after login?
You could create a small plugin to perform the redirect. Here's something I've quickly mocked up:
class plgSystemMYPLUGIN extends JPlugin
{
public function onUserAfterLogin()
{
$app =...
9
votes
How to check what component is being used on current page?
For Joomla 2.5
We can check by getting the URL parameters, using the JRequest::getVar() method and check for the option parameter.
jimport( 'joomla.environment.request' );
echo JRequest::getVar('...
9
votes
Adding custom CSS styling on some of my pages
One of my favorite approaches is to create dynamic classes for the body element.
So:
<?php
$app = JFactory::getApplication();
$menu = $app->getMenu();
$active = $menu->getActive(...
8
votes
Joomla Component Tool or Scaffold?
After writing numerous extensions for clients, I found myself following a lot of the same patterns over and over. To keep things DRY, I created a "component framework" that abstracts away most of the ...
8
votes
Understanding mvc way of component coding for both joomla 2.5 and 3 version
There is a good doc page explaining the differences between Joomla 2.5 and 3.x.
http://docs.joomla.org/Potential_backward_compatibility_issues_in_Joomla_3_and_Joomla_Platform_12.2
The only thing to ...
8
votes
Where is $this->baseurl defined in joomla?
The $this->baseurl; is a shortcut to be used from inside a template, instead of calling the JURI:base(); method, of the JURI class. It is part of the core and you can find it at /libraries/joomla/...
8
votes
Accepted
What is best approach to show the component page in popup-modal window without header and footer?
Haven't done this for awhile, but these steps should do it:
Add JHTML::_('behavior.modal'); near the top of the view
Add class="modal" to any links you want to open in a modal window
Add &tmpl=...
8
votes
Accepted
Confirmation message when deleting items in the media manager
You can add a few lines of jQuery to your admin template (or add it using a plugin that fires only for the admin area):
jQuery("a.delete-item").on('click', function(e){
if (confirm("Do you want ...
8
votes
Accepted
How to remove "Joomla! 2.5 Support Is Ending On December 31, 2014!" from admin panel?
This message is rendered by a plugin called "End of Support Notifier". The type of this plugin is "QuickIcon". To remove it go to "Extensions" -> "Plug-in Manager". Find and disable it.
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
joomla-2.5 × 409joomla-3.x × 111
php × 39
module × 31
virtuemart × 24
development × 23
component × 22
extensions × 21
joomla-api × 17
login × 17
templates × 15
joomla-3.3.x × 15
plugin × 14
k2 × 14
jquery × 13
javascript × 12
user × 11
update × 11
database × 10
emails × 10
articles × 9
menu × 9
.htaccess-configuration × 9
upgrade × 9
overrides × 8