17
votes
Accepted
Adding drag-n-drop ordering in component
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 ...
- 3,713
15
votes
Accepted
Custom Component - Need to verify if user is logged in
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 ...
- 26.7k
10
votes
Accepted
Best way to include helper class in sub-controller : require_once or JLoader
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:
...
- 3,208
9
votes
Accepted
Multiple controllers in Joomla
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 ...
- 2,295
8
votes
How to create a view with filters and pagination
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']))
...
- 2,981
8
votes
Accepted
Click on custom button opens modal window
It's actually pretty simple.
In view.html.php, load modal library, if it's not already done:
JHtml::_('bootstrap.modal');
For adding button to toolbar, use:
// Toolbar object
$toolbar = JToolBar::...
- 3,208
7
votes
Accepted
What is the recommended way to structure a Joomla 3 custom component view using angularJS?
According to my experience:
JSON views: I have created components based FoF automatic JSON rendering https://github.com/akeeba/fof In this way, it is straightforward to load /get queries. In spite of ...
- 7,415
7
votes
Accepted
Messages : Warnings / Errors
You can use enqueueMessage to display errors, for example:
$user = JFactory::getUser();
if ($user->guest)
{
$msg = 'You must be logged in';
JFactory::getApplication()->enqueueMessage($...
- 26.7k
6
votes
Accepted
Programmatically Add Menu Item in Component
firstly - menu items are not put into the assets table, so this question is about a non-existent problem. The link provided in the question gives the correct answer for joom 2.5 and 3.x. but for ...
- 3,209
6
votes
How to retrieve id of newly added row in JModelAdmin?
It is saved in the model state. You can retrieve it with:
$this->getState($this->getName() . '.id');
- 7,415
6
votes
Accepted
Component Download (from a live site)
Yes, it is possible with a component, but it will take a little longer as there are more directories and files.
Create a folder on your desktop (e.g "gallery"), then copy the XML file from:
...
- 26.7k
6
votes
How to use com_api plugin for REST?
In the context of a REST Api, each call is stateless. So, there is no "user login".
In a Joomla site, when a user is authenticated, the browser receives a cookie to authorize the navigation and ...
- 7,415
5
votes
How to set get('Items') limit?
Like others have said - put this in the model's populateState function
$this->setState('list.limit', $limit); #limit=0 removes limit
$this->setState('list.start', $start);
But you must make ...
- 151
5
votes
Accepted
Proper folder structure for custom component
There is no right or wrong way to structure your code, however there are certainly better ways.
Why
The structure we use at Joomlatools stems from the need to have a standardised developer friendly ...
- 154
5
votes
How to display names of parents instead of their ids
You need to left join the header name when you create the query in your model getListQuery() method. The actual code using the Joomla query object looks like so:
$query->select('a.id, a.header, a....
- 1,406
5
votes
Accepted
Site Vulnerability Check
The best tool I am aware of that can scan your whole web account is the one from Phil Taylor at https://mysites.guru (formerly https://myjoomla.com).
This is a paid service but you are not locked ...
- 7,983
5
votes
Site Vulnerability Check
These are the tools I use
JOOMLA EXTENSIONS
Watchful.li: similar to myJoomla.com and also monthly
https://watchful.li/
RSFirewall: Has the best scan for malware and files that do not belong in ...
- 1,901
5
votes
Accepted
How to call a model method from a system plugin?
This will work with ease in Joomla 3.x
//load model
JModelLegacy::addIncludePath(JPATH_SITE . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_foo' . DIRECTORY_SEPARATOR . 'models');
/...
- 1,662
5
votes
Component Development PHP Version Check
Lots of components have a check like that. Here's the top of admin tools core install script eg.
protected $minimumPHPVersion = '5.3.3';
public function preflight($type, $parent)
{
// ...
- 3,209
5
votes
Accepted
How to execute an ajax script to update form fields in an .xml file rendered by Akeeba FOF?
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/...
- 9,621
4
votes
Available fields in Joomla XML manifest
There is also one other neat trick - when using Radio buttons, you can add Bootstrap class and they will look nicer. Look for class attribute in this code:
<field name="some-choices" type="radio" ...
4
votes
Date/time picker in component
The only downside to @johanpw's solution is by using #datetimepicker2 that means this field type can only be used once. Good solution otherwise!
Instead try the following in your /modules/...
- 41
4
votes
Accepted
Overriding the core layout for Featured Articles Component
Layout Overrides » Alternative Menu Items
From your question I understand that what will fit your needs is to create an alternative menu item for the Featured Items menu item.
This is almost ...
- 19.6k
4
votes
Accepted
Adding an icons to backend submenu items
You can use the first parameter of addEntry() for that, for example:
public static function addSubmenu($submenu)
{
JSubMenuHelper::addEntry(
'<i class="icon-home"></i>' . ...
- 3,713
4
votes
Accepted
Array of form fields
I manged to get a solution as below.
<field name="gralev_code][]"
type="text"
class="width20"
label="JSCH_GRALEV_CODE"
/>
in model.php
$formdata = $this->_jinput->get('jform', '...
- 2,671
4
votes
Custom Component - Need to verify if user is logged in
Althugh Lodder have answered my questions, Here's what I did which I feel more sophisticated way to deal with custom component. It adds return parameter to com_users component.
In Main Controller, (...
- 1,292
4
votes
How to launch an asynchronous php process
It seems to me that the question you are asking is perhaps not the one you meant to ask (if I may be so bold). I'm assuming that 18-20s response is unacceptable either because it's a poor user ...
- 304
4
votes
Accepted
Storing data in a single column of a table OR as the part of json
There are several ways to store data in databases, how you wish to do it depends on your application, it's depth and future growth.
I'm no expert in this area, but I do have the experience to know ...
- 166
4
votes
Accepted
Adding custom fields to com_content category
Yes, you can add custom fields to the com_content (category? I assume you intend component?):
https://docs.joomla.org/Adding_custom_fields_to_core_components_using_a_plugin
https://zunostudios.com/...
- 130
4
votes
Accepted
Get all installed Joomla extensions and their version
Any extension that is installed, is stored in the database, in the #__extensions table. So you can run a simply database query to get the name and the manifest cache (which contains the version):
$db ...
- 26.7k
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
component × 525joomla-3.x × 226
development × 103
custom-component × 54
php × 38
module × 36
mvc × 35
plugin × 31
extensions × 29
view × 27
joomla-2.5 × 22
joomla-api × 20
form × 18
ajax × 17
administrator × 16
joomla-4.x × 16
model × 16
database × 15
mysql × 14
jform × 13
overrides × 12
menu-item × 12
articles × 10
templates × 10
joomla-3.4 × 9