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.

Filter by
Sorted by
Tagged with
2 votes
1 answer
91 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 ...
user avatar
  • 2,275
1 vote
2 answers
565 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....
user avatar
  • 325
0 votes
1 answer
47 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 ...
user avatar
  • 2,275
0 votes
2 answers
45 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 ...
user avatar
  • 213
0 votes
1 answer
151 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 ...
user avatar
1 vote
1 answer
194 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',...
user avatar
  • 2,275
4 votes
1 answer
92 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 ...
user avatar
  • 2,275
3 votes
1 answer
173 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 ...
user avatar
  • 4,448
4 votes
2 answers
839 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 ...
user avatar
  • 1,839
3 votes
1 answer
368 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 ...
user avatar
  • 113
0 votes
2 answers
5k 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 ...
user avatar
  • 437
5 votes
1 answer
1k 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 ...
user avatar
  • 1,095
2 votes
1 answer
771 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. ...
user avatar
  • 1,095
1 vote
1 answer
950 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 ...
user avatar
  • 11
0 votes
1 answer
46 views

What steps shoud I include in a health check on an existing Joomla website I am being asked to look after?

I am sometimes asked to adopt orphaned Joomla websites when the original service provider is no longer able or available to do so. What steps should I include in a health check before agreeing to ...
user avatar
4 votes
2 answers
3k views

What is the best way to require_once?

METHOD 1 Hard coding the directory separator require_once JPATH_COMPONENT.'/models/fields/courselist.php'; METHOD 2 Soft code the directory separator if(!defined('DS')){ define('DS',...
user avatar
  • 2,651
1 vote
2 answers
889 views

Proper way to call/use plugin parameters

I know this could be interpreted as a minor or a newbie question but I would like to improve my code. So, in a best coding practice perspective how to call/use plugin parameters? My two code examples ...
user avatar
  • 871
8 votes
2 answers
375 views

Where to place code in Joomla modules

When developing a Joomla extension, are there any best practices, guidelines or recommendations regarding where to place the different parts of my code (PHP and HTML)? I'm mostly thinking about the ...
user avatar
  • 13.3k