A message from our CEO about the future of Stack Overflow and Stack Exchange. Read now.
4

You can use JSON format in the controller directly by adding .json suffix and changing format in your URL to json. In this case the controller would be placed in /administrator/components/com_example/controllers/ajax.json.php. It's contents: defined('_JEXEC') or die; use Joomla\CMS\Factory; use Joomla\CMS\Response\JsonResponse; class ExampleControllerAjax ...


3

This component is developed using Akeeba FOF, so you need to read the documentation to know how to complete the task. Almost everything is configured using XML, this is to some extent of course. To add the onchange javascript code to the dropdown list: https://github.com/akeeba/fof/wiki/XML-Form-Fields#additional-attributes-for-drop-down-list-fields Also, ...


2

Have you done already these basic checks? 1 - Enable Joomla Caching This will already significantly boost your page loading times Go to your plugins and open Page Cache plugin Usually it shall be already configured like this: Save and close it 2 - Configure your Cache TTL and behaviour Go to System - Global Configuration - System(-tab) Enable the ...


2

Recent Joomla version can handle the errors based on native PHP exceptions, so just throw an exception with corresponding message and value, Joomla will display the error page set (template, custom…) if ($someCheck) { throw new Exception(JText::_('JERROR_LAYOUT_PAGE_NOT_FOUND'), 404); } Source: Whats the correct way for exception handling?


2

You can use the robots.txt file to disallow the indexing. Try using this directive in your robots.txt file. User-agent: * Disallow: /*?option=com_users* The cons of this approach is that not all search engines crawlers observe the wildcard syntax. I think this will do the trick with the major ones (Google, Bing and Yahoo). I found this and this ...


2

I had the same problem on twitter. I was trying to add my link picture just as facebook does automatically but had to investigate the CARD Validator here https://cards-dev.twitter.com/validator ...Tthe way I have it working on Joomla 3.9.11 is adding this code in the head of my template default.php ... I was able to properly add the title, the description ...


2

There is the install script there for this task in Joomla which can fire on different points of the extension install or uninstall processes, like install, uninstall, preflight, postflight and on update. You can use that script with your extension (plugin, component or module). You can run any kind of functions at the different events. You have to study the ...


2

Create a installer script for your component (com_your_component_name/script.php) and add the following code: <?php defined('_JEXEC') or die; class com_your_component_nameInstallerScript { function update($parent) { JFile::delete($path.$file) } } The installer script file allows you to run code when your component is installed, uninstalled, ...


2

For the purpose you are describing, your best bet is to create your own Joomla custom library. It's a type of Joomla extension alongside with plugins, modules and components, allowing you to put your custom common code. There is not much examples in Joomla documentation but Roberto Segura (phproberto) made an awesome example of a custom library available on ...


2

In your index.php, you can use the following: <?php $menu = JFactory::getApplication()->getMenu(); ?> <?php if ($menu->getActive() != $menu->getDefault()) : ?> <jdoc:include type="component" /> <?php endif; ?> All this basically does is check if the active menu item doesn't match the default menu item. If it doesn't, ...


1

Website visitors can be directed to a maintenance page at index.html or index.htm rather than any kickstart.php or index.php file as most hosts are configured to load index.html or index.htm in preference to index.php. You can ensure this is the case by adding the following directive to your .htaccess file: DirectoryIndex index.html index.htm index.php It ...


1

I figured it out. Instead of using the JTable class, I import the model gameModel as described here. The by deleting the item via the model, the tag-associations are removed as well. This is the code change: public function delete(&$pks) { jimport('joomla.application.component.model'); JModelLegacy::addIncludePath(JPATH_SITE.'/...


1

I'm a little confused by created therefore a simple PHP project so I'll assuming by this you're referring to your component. Basically, all Joomla clases (Jxxx) are autoloaded (I think with exception of a couple such as JFolder, JFile, and a few others), so you can just access them directly without having to import them: $user = JFactory::getUser(); $...


1

To answer the question about what is core and what isn't when you look at the extensions under the Extensions->Manage->Manage menu look at the ID column on the far right and if the ID is less than 999(or only has three digits) then it is core, if it above 10000 then it is 3rd party. If the site has been progressively migrated from early versions of Joomla ...


1

Any layout or view can be overridden in Joomla. You can do this in your Joomla admin panel, by going to: Extensions (top menu) >> Templates >> Templates >> Details and Files Once there, go to the "Create Overrides" tab, and you will be able to select your component annd the view. So let's say you create an override for com_content/archive. This will ...


1

The problem was solved by adding the JHtml::_('behavior.framework'); directive in the view so that the problem of: ReferenceError: Joomla is not defined that occurred when you clicked on any of the pages of the pager component The final code is <?php defined('_JEXEC') or die('Restricted access'); class DemoViewDemo extends JViewLegacy { public ...


1

Looking at how Weblinks works I can see that the only time weblinks.go gets involved is when you have have an option selected to count Hits for each link causing view.html.php to display this style of link: $item->link = JRoute::_('index.php?option=com_weblinks&task=weblink.go&id=' . $item->id); at line 88 of default_items.php I would ...


1

From your question it is ambiguous whether your entry file is inside the admin subfolder or not. It should be in the com_administratie folder if it isn't. Also your xml files declaration looks odd: <files folder="components/com_administratie/admin"> <file>administratie.php</file> </files> The folder attribute should just be site ...


1

It looks like you have activated Search Engine Friendly URLs in this case you need to add to your robots.txt User-agent: * # disallow login from of joomla Disallow: /component/users/


1

Use file manifest to install files not belonging to any extension: <?xml version="1.0" encoding="UTF-8"?> <extension version="3.9" type="file" method="upgrade"> <name>files_cli_example</name> <author>Example</author> <version>1.0.0</version> <creationDate>January 2019</creationDate> ...


1

The comment from @mickmackusa is essentially correct, but there's some context missing, perhaps, from your question that makes me wonder if you're not asking a wider question. There are wide variety of reasons for the overrides you're seeing. In an MVC world "save" is both a controller and a model method. It stems from the concept "separation of concerns." ...


1

Looks like the variable $params isn't getting set. Could be several reasons this is happening, among them that there isn't a menu item set in the current URL. As @lodder noted, this is old code. The mechanism involving the static call of getMenu from the site application was deprecated years ago; nobody should be using it anymore. (Don't remember precisely ...


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