Questions tagged [best-practices]
This tag should only be used when a key objective in the question relates to any combination of: efficient processes, sustainable architecture, Joomla! Coding Standards, general web security, direct/purposeful actions, and other such foci where optimisation is valuable. This tag is most appropriate when a basic solution is already realised, but refinement is sought.
19 questions
1 vote
1 answer
332 views
Joomla 4: no need for Route::_($url)?
I am using this on a custom component: $url = index.php?option=com_content&view=article&catid=427&id=15106 Both echo $url; echo Route::_($url); will output a friendly url. I'm guessing ...
2 votes
1 answer
144 views
Display instructions or other text in Plugin
I would like to display some basic text, instructions and maybe a change log in HTML would be nice, under the first tab of my Plugin, what methods or techniques are available? In my sample screen shot ...
1 vote
3 answers
2k views
Best practices for Joomla - Get another model in a view from another controller
I need to get data from another model than the view specific controller/model into the view. But I'm not sure if the way I'm doing it now is correct. I do that via the following way in the view.html....
0 votes
1 answer
75 views
How do you organise your code in a Joomla extension?
I am looking for examples of how people organise their code in a Joomla extensions, particularly components, that is beyond the basics shown in tutorials teaching you MVC and Joomla. A look through ...
0 votes
2 answers
101 views
What directory should contain GPL scripts from external source? Best practice?
I am making a custom gallery module using Light Gallery. In most cases, I would just place all my JS files inside /assets/js directory. But I wonder if this is good practice when using an external ...
0 votes
1 answer
240 views
Create a User Area
I'm wondering how i can create a User Area for users to login and gain access to a user panel (where user can update their info and specfic/custom actions). Because the Joomla user login ...
1 vote
1 answer
512 views
Which one to use? grid.sort vs searchtools.sort
I have been looking at why column sort orders wouldn't change in the front list view of my component and found by changing <?php echo HtmlHelper::_('searchtools.sort', 'JGRID_HEADING_ID',...
4 votes
1 answer
215 views
How is onContentAfterSave working in the Front End?
I have created a plugin that works using onContentAfterSave to fire off some other processing once a record is saved. This works as expected in the Back End but nothing gets triggered when I save a ...
3 votes
1 answer
281 views
Issues to be aware of when calling `concatenate()`, `regexp()`, `rand()`, and `castAsChar()` in sql queries
I'm taking it upon myself to become aware of some of the lesser known/used query methods because I like toying with MySQL and I want to implement Joomla calls when possible/sensible -- because they ...
4 votes
2 answers
955 views
Can I safely disable the core components I don't use
I don't really use: Contacts Banners Search Newsfeeds So my question is: Are they safe to disable? Are they safe to uninstall? Ideally, I'd like to make my installation as lightweight as possible. ...
3 votes
1 answer
447 views
Where to call for CSS/JS in custom component for frontend views
I've created a custom component with a dashboard that needs styling with CSS. I've created the CSS file and I'm looking at calling for it in the frontend view. Working with J! 3.6.5 and a MVC ...
0 votes
2 answers
6k views
What is the best way of using PHP code in Joomla's articles or modules?
Let's say I need to create a simple page and for my links I want to use JRoute::_() in order to make them SEF or display ID of the current user. What would be the best way to achieve this? Joomla by ...
6 votes
1 answer
2k views
How to add a composer package without modifying the core composer.json file
I am trying to add a Composer Package and make it globally available but I do not want to modify core composer.json for obvious reasons. Is the only way to do this having a composer.json either on ...
2 votes
1 answer
871 views
Can we create different configuration.php file for multiple environment?
We have a project setup which has three different git branches (development, staging and production). We are trying to find the best way to setup (if possible) the configuration.php for each branch. ...
1 vote
1 answer
994 views
Site gets hacked and everytime a new user is created with Admin rights
We are facing a weird problem. We have a site set-up in Joomla. The site is getting hacked on a regular basis and specifically during the weekends. The strange thing is, we see that a new user is ...