47

PLEASE NOTE THAT THIS ANSWER is already a few years old and was not updated. Feel free to edit / comment if you think something is no longer exact. Abstract There is almost no really official way of dealing with this, it much depends on the complexity and how much you want to rely on the MVC pattern to do the work. Below are some possible solutions what ...


23

I will provide the list of my bookmarked links and a list with links for Joomla Development Books, with various resources all around Joomla Development. I hope they will be useful for anyone interested: Joomla Beginner Users start here: Joomla Beginner Tutorials - How to start with Joomla? Glossary - It's a good idea to get familiar with Joomla Glossary ...


20

This is a late answer for this very well answered question, but I wanted to add this cut-to-the-chase solution for those that just need a simple way to get to their components's data with an AJAX call. With all the Joomla versions, 3rd party possibilities, and hacks that I found over several days of googling, this was the simplest approach I could come up ...


19

The AHA! moment - #__content no longer has the params column, so the following adjustments have to be made for the plugin to work with components/tables with attribs instead of params (which appears only to be #__content as of v3.2): Change the fields name to "attribs" Change the fieldset name to something unique (I used the plugin name) Add a language ...


16

You can import com_content models into the controller using addIncludePath() method: JModelLegacy::addIncludePath(JPATH_SITE . '/components/com_content/models', 'ContentModel'); addIncludePath() method adds a directory where JModelLegacy should search for models. You may either pass a string or an array of directories as the first parameter. As the second ...


16

There are some prerequisites and you have to do some modifications to your view template. But you don't have to develop this feature all on your own. Prerequisites You need a column ordering of type INT to your database table Your list view should already be sortable (by clicking on the table column headers) Modifications This is the most important part ...


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::...


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 ...


12

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


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

That code is looking in the article text you need to is in the images call. It is json encoded so you have to decoded it first. $images = json_decode($this->item->images); echo $images->image_intro; Have a look at the com_content/article/default.php template to see some of the other parts of data you can use for images.


11

Valentin answer is good but is a bit overly complex if all you need to do is add 1 or 2 ajax calls to a component that is already built. It's perfectly possible to get away with not making separate controller.raw.php or view.raw.php files. To make this ajax call index.php?format=raw&option=com_example&controller=job&task=keep_alive&...


11

Numerous types of form field are built into Joomla, with many usefull fields like calendar, color picker, image picker, file upload, file selection etc.: Available Fields +---------------------+-------------------------------------------------------------------------------------------------------+ | TYPE | DESCRIPTION ...


11

You can use Joomla's user object for this. $user = JFactory::getUser(); // Get the user object $app = JFactory::getApplication(); // Get the application if ($user->id != 0) { // you are logged in } else { // Redirect the user $app->redirect(JRoute::_('index.php?option=com_users&view=login')); } If you would like to display a ...


10

So technically you start transitioning to the new MVC classes now - there's nothing stopping you. For example com_config in Joomla core is already using the new MVC classes. However as you probably know the Jxxx classes are pretty much empty so a lot of the work will be putting in the same level of code as in the current JxxxLegacy classes. This will mean ...


10

I believe I have your solution, but do NOT hack the core. We felt forced to do that over the years, and we're still paying the price even today, missing updates, revisiting hacks everytime we do update, and general incompatibility with other components. What we now do is this: New table #__content_ext with a key field that is identical to #__content and ...


10

Here is a draft idea using a plugin: You need to create a system plugin (I am not getting into that) and to use the event onBeforeRender. Inside you get an instance of your Toolbar and append the button. class PlgSystemCustomtoolbar extends JPlugin { public function onBeforeRender() { // Get the application object $app = JFactory::...


10

Actually JLoader::register('TestHelper','/path/to/test.php'); dosen't load file, it just registers it to be able to autoload file if class is instantiated. Do require it instantly, you want to use: JLoader::import('TestHelper','/path/to/test.php'); Note: for this your file name should be TestHelper.php. which will include_once the file if it exists (...


9

As Milton already wrote you specify where those SQL files are in the install manifest file. There are three different locations for install, uninstall and update. <install> <sql> <file driver="mysql" charset="utf8">sql/install.mysql.utf8.sql</file> </sql> </install> <uninstall> <sql> ...


9

Ok, I've solved it. I removed the " " marks around $this->item->heading as follows: $browserbar= $this->item->heading; $document = JFactory::getDocument(); $document->setTitle($browserbar); and now it's working!


9

I think you're confusing the purpose of your main / master controller (controller.php) and subcontrollers (everything in the /controllers folder). For more on this, see the docs. The main controller is typically used to do what you mention in your comment (render a view based on the view parameter, usually specified in the URL). In controller.php, the ...


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

I can recommend the official doc page. There is a section for developers which includes also tutorials. http://docs.joomla.org/Portal:Developers David Hurley is currently doing a series of short videos which explain how to develop various things. http://dbhurley.com/jd101-joomla-development-tutorial-series/ The API page is a good ressource as well. http://...


8

You can find what is the missing component by either checking what is the component assigned to that specific menu item that creates this page, or if there is no menu item for this page you can disable SEF URLs in the Global configuration and find the name of the component by the option=com_component part of the URL. URL Example: www.mysite.com/index.php?...


8

Follow the below steps: Filters: 1) Make sure to add all your filterable fields in your model constructor public function __construct ($config = array()) { if (empty($config['filter_fields'])) { $config['filter_fields'] = array( 'id', 'a.id', 'catid', 'a.catid', .... .... ); } ...


7

Valentin's answer is good. I prefer a json controller that handles the encoding and error handling for this I created a json base class: class itrControllerJson extends JControllerLegacy { /** @var array the response to the client */ protected $response = array(); public function addResponse($type, $message, $status=200) { array_push($this-&...


7

You may need to import the table classes also. Try calling JTable::addIncludePath(/path/to/other/component/tables); to bring them in.


7

Previous answers are comprehensive about Joomla Core MVC. As an alternative MVC for Joomla, FOF https://www.akeebabackup.com/documentation/fof/introducing-fof.html#what-is-fof https://github.com/akeeba/fof What is FOF FOF (Framework on Framework) is a rapid application development framework for Joomla!. Unlike other frameworks it is not standalone. It ...


7

I'm not sure if this is the best-practice way of doing it (please comment if there's a better way), or it is exactly what you're looking for, but here's my approach using a Joomla article as an example: Files of Interest components\com_content\views\article\view.html.php components\com_content\models\article.php Modify view.html.php Near the top of ...


Only top voted, non community-wiki answers of a minimum length are eligible