Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.
7

Running ahead a little bit let me provide you with link to JooYii Library. This library makes a leap ahead brings some practices that would be at Joomla! 4 to current Joomla! 3.x branch along with other good things [common MVC, methods variables checks and bindings and other]. It's not reached first master yet, but only few inches around. What concerns ...


6

From joomla 3.0 onwards a layout sharing feature is introduced, using it you can call a layout across views or extensions. It requires creating a layout object and then render the view using that object as: $layout = new JLayoutFile('my_layout', $basePath = JPATH_ROOT .'/components/com_something/layouts'); $html = $layout->render(); this will render the ...


6

You don't have to use only 2.5 or 3.0, you can also use 3.4 or any other Joomla version: <extension type="component" version="3.4" method="upgrade"> The version attribute specifies the minimum Joomla! version needed for your extension, ie your extension will work with 3.4 and every version after that.


5

It looks like you're creating a new cart array instead of starting with your stored data. Try this: $session = JFactory::getSession(); $cart = $session->get('cart',array('items'=>array())); $cart['items'][] = array( 'action' => $app->input->get('action', 'add', 'STRING'), 'domain_name' => $app->input->get('...


5

If you're only ever using a library within a single component then there's no reason not to include it in a folder in the component - this is the way that distributed components will generally handle it. That being said, you can put anything you like in the libraries folder and Joomla won't mind, the issue is how you go about loading the classes. Joomla ...


5

Your plugin appears to be written for a very old version of Joomla! The event in current versions is onContentBeforeSave. You are also missing $context argument. It's a good idea to check for context to make sure that you're modifying the correct content type (e.g. article). public function onContentBeforeSave($context, $article, $isNew) { if ($context !...


4

Firstly, you're importing the wrong files which are required when using the Joomla API. You then also need to initialise the application. try the following: define('_JEXEC', 1); define('JPATH_BASE', dirname(__FILE__)); require_once JPATH_BASE '/includes/defines.php'; require_once JPATH_BASE '/includes/framework.php'; $mainframe = JFactory::...


4

Well, as per my answer from the link you provided, you'll need to add the following to your default.php: <div id="j-sidebar-container" class="span2"> <?php echo $this->sidebar; ?> </div> So you can simply add an extra class after span2, for example: <div id="j-sidebar-container" class="span2 mySidebar"> Then apply your own ...


4

First of all, this documentation is very old. Latest is here. You can't just add class to that. You would have to create your own JHtml* class and override it there. Following is just example, you can rename class and file names if you prefer. components/your_component/html/mygrid.php abstract class JHtmlMygrid { public static function id($rowNum, $...


4

In your Joomla installation directory reach templates/themeXXX/error.php file. Edit the error.php file as shown below, locate this line of code: If you don't want to change address bar url then you can use below code if (($this->error->getCode()) == '404') { header("HTTP/1.0 404 Not Found"); echo file_get_contents(JURI::root().'alias-of-404-article-...


4

Use Form::setFieldAttribute(). Typically, this is done in the model's getForm() method. However, if it's cosmetic only, it can be done in the view too. In /administrator/com_image/models/forms/image.xml (outside of a <fieldset> is fine): <field name="myNote" type="note" class="alert alert-info" /> In /administrator/com_image/views/...


4

Inside your table's constructor use setColumnAlias() to define the actual column name: public function __construct($db) { parent::__construct('#__example', 'id', $db); $this->setColumnAlias('published', 'state'); }


4

1) JHtml is an alias for Joomla\CMS\HTML\HTMLHelper class. You'll have to start using the real class sooner or later because the alias will not exist in Joomla! 5.0. To use the real class you have to either import it: use Joomla\CMS\HTML\HTMLHelper; HTMLHelper::doSomething(); HTMLHelper::doSomethingElse(); Or use fully qualified class name: \Joomla\CMS\...


3

The best place is your table class before storing data. For example below code in store function of table class. public function store ($updateNulls = false) { if ($table->load(array('alias' => $this->alias, 'catid' => $this->catid)) && ($table->id != $this->id || $this->id == 0)) { $this->setError(JText::_(...


3

To generate a list of tags you can take getTagTreeArray() method from JHelperTags class as a base and modify it for you needs - you can populate the resulting array not only with the IDs, but also with the tag names. Then on frontend you can use getTagRoute() method of TagsHelperRoute class to get the tag link. Hope this helps.


3

The format you are using is normally associated with sub-menu's - I think the tutorial is incorrect/out of date — in our components the main administration menu item looks like this: <menu img="../media/com_componentName/images/icon.png">COM_COMPONENT_XML_NAME</menu> I would recommend reading the article on Joomla Manifest files and the ...


3

It turns out my problem was caused by the use of the onsubmit="" event at the form tag. NOTE: This is back-end code, I only have this problem when using the JToolBarHelper::buttons(); Here is what I used to do: view.html.php JToolBarHelper::save('simplelistitem.save'); JToolBarHelper::apply('simplelistitem.apply') edit.php <script> function ...


3

This is because the JPATH_BASE value needs updating as you've moved the file into a new directory. So replace this: define('JPATH_BASE', realpath(dirname(__FILE__).'/')); with this: define('JPATH_BASE', realpath(dirname(__FILE__).'/../'));


3

So the purpose of metadata.xml is storing the data that need to be shared across layouts: each layout.xml inside of your view tmpl directory extends metadata.xml. So if you need to put some request fields in each layout - you can simply add this fields to metadata.xml and all the layouts will inherit them. For example file /site/view/examples/metadata.xml ...


3

If the utility classes are only used in your component then include them in a folder within your administrator component. Whether you register the classes with JLoader or just require_once them just set the path like: JPATH_ADMINISTRATOR . '/your_component_name/utilities/a_class.php'. If you have several utility classes then put all calls to the classes in ...


3

I solved the issue. Problem was that when insert query was called in a loop 2000 times, deadlock occurred and returned a blank page. The solution to this is to construct one single insert query and then insert the values. Following is the code I added in model file - Instead of calling insert method in loop I formed the insert values array: $getValues = ...


3

In your table's bind function, add this: if ( ( !empty( $array[ 'list_links_url' ] ) && ( is_array( $array[ 'list_links_url' ] ) ) ) ) { $this->_jsonEncode[] = "list_links_url"; }


3

You can create a plugin that triggers on onUserAfterLogin and redirects the user to where you want. or you can add a &return= query variable to your links to the login page as described here


3

One thing is, that you're trying to create a router in the old way, it changed over time. Now router is a class. Second thing is, one of your component views have to be set as a front-page for a system. Without that, in most websites the default router will be com_content's router, so every wrong URL(url that don't have a proper menu item/parent item) will ...


3

You can certainly add CSS or JavaScript by creating a plugin or module but the quickest and easiest way to do this is probably using a third party extension such as the EasyScript plugin or the Flexi Custom Code module or similar. The advantage of using the module is that code can be assigned to specific pages. There is often an option to add custom CSS in ...


3

The /component/name/ part of the url is automatically written by Joomla router when there is no matching menu item found. This is required for the application to route the command to the proper component. So in your case, the pattern can be removed by creating the menu item. Since the menu item is already mapped to a component view, the routing will happen ...


3

The return value of onUserAfterLogin() should be a boolean -- ie true or false. The idea is that you can use this event handler to do additional validation on the login, so if you return false, it indicates that the login should be rejected. What you want to do is quite different; you're trying to add content to the page after login. There's several ways of ...


3

You can check the field from where it is coming, <? php echo $this->form->renderField('partno'); ?> This line rendering your field 'partno', by looking into generated html it seems it is jform , So you need to go to "site/components/[component_name]/models/forms/form_name.xml file" check the field name as 'partno' it might be sql field or ...


3

raVan96 is bang on, you should have either a sql field or a list field. But, what you have was an sql field that you have replaced with a custom list field. There are two main issues. The form xml field attributes key_field and value_field only apply to sql fields, not to list fields. Hence, they are doing nothing here and you should remove them. <...


3

If I understand it right. You wan't to get the ID of the current active menu. Theres a great example on this forum: https://forum.joomla.org/viewtopic.php?t=642224 Here's the code part: // get application $app = JFactory::getApplication(); // get menu $menu = $app->getMenu(); // get active menu id $activeId = $menu->getActive()->id; // ...


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