23

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('option'); For example, if you are displaying an Article and use the above code, it will output com_content


19

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&view=reporting', true ); echo JRoute::_('index.php?Itemid='.$menuItem->id); This has worked wonders for me.


17

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 apps front-end/back-end) and are designed to display a piece of information. So if you open the module folder/files and start reading the code, you will ...


16

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(); $prefix = $app->get('dbprefix'); But Joomla documentation recommends that you never modify the prefix. I know some backup software allows you to make a ...


15

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 other general information on the component itself. You can then download an installable zip file to get the component started. For those that are happy jumping ...


15

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 you look at all the articles in the series. http://docs.joomla.org/J3.3:Creating_a_simple_module/Introduction http://docs.joomla.org/J3.3:...


15

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 a field called "Page class". This will add a class to your <body> tag (or a <div class="YOURCLASS">...</div> around your content), depending ...


15

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:// into consideration. It then tries to get the Joomla manifest file and checks whether is exists/is readable. If it exists then it gets the value from the <...


14

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 potential directory listing of the files. The tmp (temporary) folder is used by Joomla and its extensions when performing software installations or during the ...


14

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, where the location of the user registration form is well known and by default public accessible, it's easy to start filling up and submitting the forms. ...


13

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 your exact case, you can wrap your code in a try / catch block to get the error, as shown in this SO answer: try { ... $db->setQuery($query); $...


13

$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 PHP magic based on a few variables. So, lets run a few tests. Please report the results back: Test 1: <?php echo 'Rule 1: ' . JUri::base() . '\n'; ...


12

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('yourcontroller.add'); JToolBarHelper::editList('yourcontroller.edit'); } So these will call the task/function "add"/"edit" in your specified controller. ...


12

I use this way: // Check for component if (!JComponentHelper::getComponent('<component name>', true)->enabled) { ..... } <component name> - without "com_" prefix


12

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 Long Term Release version of Joomla. For Joomla 3.x, the main thing I tend to look at is the following: Potential backward compatibility issues in Joomla 3 In ...


11

"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 my plan: Backup the main site and create a new test site Review the system requirements for Joomla 3.x and make sure that your server environment meets those ...


11

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 the right hand side (in this case "Registered"), and set Offline Access to "Allowed". (Default setting is "Inherited", thus Not Allowed. Save. Your registered ...


11

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 disabled by setting Users -> Manage -> Options -> Allow User Registration to "No". You can then delete all users except the Super Administrator account....


10

.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 parent menu item. But sometimes you want to show just the first level in your main menu and show the other levels in a side menu, for example. .deeper is then ...


10

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 = JFactory::getApplication(); if ($app->isAdmin()) { $user = JFactory::getUser(); $groups = $user->get('groups'...


9

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('option', '') JRequest API Documentation


9

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 sample: <main id="content" role="main" class="main"> <?php if ($this->countModules('myposition')) { ?> <jdoc:include type="modules" ...


9

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(); $class = $active->alias . " pageid-" . $active->id; ?> <body class="<?php echo $class; ?>"> Some examples of what the above code ...


8

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 common tasks that I do, but so far it's only been used internally at my company. It lacks a lot of features, but it gets the job done for what I need. I said ...


8

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 mention is that the legacy classes are only available in Joomla 2.5.5 and higher. But anyone should be on 2.5.19 nowadays anyway :)


8

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/environment/uri.php (~line 218). If you look at the method, you will see that it checks in the configuration file to see if the $live_url variable is defined. ...


8

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 yourmodulposition}'); to the view file. The second string with the load position short tag can be replaced with a var which contains more html if you need that. You don't ...


8

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=component the the link you want in a popup Note: I answered, then deleted this because upon trying it with a J3.3 installation, I got some javascript errors, so ...


8

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 to delete this image?") != true) { e.preventDefault(); } }); That will catch the click on the delete button X and display a dialog box. Edit: The ...


8

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 voted, non community-wiki answers of a minimum length are eligible