Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [php]

PHP is a server-side scripting language designed for web development but also used as a general-purpose programming language. Joomla is based on PHP.

26
votes
3answers
10k views

What's the proper way to get the entire $_POST?

In Joomla! 2.5.x I could simply run JRequest::get('post'); but seeing as JRequest is deprecated in Joomla! 3.x I should use JInput. At them moment this is the code I'm using to get the entire $_POST: ...
7
votes
2answers
918 views

What is the Joomla Execution Flow, after a request reach to index.php till the final output on the browser?

Based on this question: How Templates work and load css/js files? Website building process with Purity III Quote: .... I have to present my website tomorrow and i may get asked "where does the ...
30
votes
3answers
4k views

Method for creating a subquery using JDatabase

At http://docs.joomla.org/Selecting_data_using_JDatabase, there isn't a documented method for writing a subquery using JDatabase. https://gist.github.com/gunjanpatel/8663333 exemplifies one way of ...
19
votes
3answers
7k views

Whats the correct way for exception handling?

In Joomla core I find still many calls like this: // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); ...
9
votes
2answers
3k views

Create categories, subcategories and articles using php

Is it possible to dynamically create Joomla categories, subcategories and articles using PHP scripts? Is there any example link?
6
votes
2answers
3k views

Logging in user without getting password from them

My requirement is something like login by Facebook, so the user does not provide password but gets logged in. I want to make a user logged in from within extension code by knowing his user id and/or ...
18
votes
6answers
16k views

How to detect if user is Super User?

To determine whether the visitor is a guest, we use something like this : if ($user->guest) { echo 'Hello, guest!'; } Now, if i want to determine whether the visitor is a registered SuperUser (...
10
votes
2answers
2k views

What's the difference between JHtml:script() and $doc->addScript?

I developed a module recently that required certain JS and CSS files to be injected into the <head> of each page. Initially, I used: $doc =& JFactory::getDocument(); $doc->addScript(JURI:...
4
votes
3answers
17k views

Joomla DB Insert, how to get last inserted id?

I have to insert my data into 2 different tables, in the first table I have the following query which works perfectly: $insertProjectUser = 'INSERT INTO #__pmanager_user (user_cms_id, user_email, ...
9
votes
3answers
13k views

Remove Article ID from Joomla 3 url

I am trying to remove the article id from a Joomla 3 URL. I searched around and the response is in components\com_content\router.php change 0 to 1 in $advanced = $params->get('sef_advanced_link', ...
3
votes
2answers
4k views

How to change Joomla date format in a component

I would like to change the backend Joomla 3.0 date format for a custom component. Right now the component is taking the Joomla date backend format which is Y-m-d and that I need to change to d-m-Y for ...
3
votes
2answers
453 views

Call controller's publish-function from “outside”

I modified the publish-function of my sub-controller as follows /** * publish function. * * @access public * @return void */ public function publish() { $...
2
votes
1answer
953 views

Function getLanguage() does not return current language?

I'm trying to get the current selected language. Here is the part of my code: define('_JEXEC', 1); define('DS', DIRECTORY_SEPARATOR); if (file_exists(dirname(__FILE__) . '/defines.php')) { ...
2
votes
1answer
346 views

Importing Joomla CMS to custom PHP script (outside root folder)

I am trying to import Joomla CMS to a custom PHP script by this : define( '_JEXEC', 1 ); define( 'JPATH_BASE', realpath(dirname(__FILE__).'/' )); require_once ( JPATH_BASE .'/includes/defines.php' );...
11
votes
4answers
11k views

How to build a RESTful API with Joomla

I have been building Joomla extensions since v1 but I soon need to take an API live that I have built and have been using for a while. Currently I am using Joomla 2.5 and have written plugins for this ...
10
votes
1answer
8k views

Displaying a Joomla module using PHP?

Can i display a Joomla module using PHP? What would be the script to achieve this? (If it's possible!)
6
votes
1answer
624 views

Database query where() value is a number

As we know, any values that are defined in a database query should always be escaped in Joomla using $db->quote($value). When defining numbers as a variable, one would normally use (int) to set ...
7
votes
2answers
1k views

Get Value of Repeatable Field from Joomla XML manifest

repeatable - How to get values from this field type ? I am coding a Free module with a repeatable field. <field name="star_slides" type="Repeatable" icon="list" description="" label="Edit Your ...
5
votes
1answer
3k views

How to know which usergroup/specific access level user belongs to

For determining whether user is a super user, we do something like this : $user = JFactory::getUser(); $isAdmin = $user->get('isRoot'); if ($isAdmin) { echo 'You are an Administrator'; What would ...
4
votes
2answers
6k views

Error 503 service unavailable in my Godaddy hosting with Joomla 2.5 website

I create a Joomla website before 1 year, but before 1 month my Godaddy hosting said we have reached all resources and the CPU 100%, when I contact the support they said we have a PHP Script that start ...
8
votes
3answers
5k views

How do I pull data from a K2 extra field that is an array?

I'm building a site that uses K2 extra fields, but I'm customizing the output so I'm not just pulling the entire extra field block. Normally something like this works for single entry fields: <?...
7
votes
1answer
3k views

SMTP no error but not sending email

I have been battling with this for some time now. I have built a custom component for forms and it uses Joomla's mail functions to send email. I have checked all the data to make sure it is correct ...
6
votes
1answer
353 views

Implement CSRF anti-spoofing using the Joomla Framework

I have used the methods described on this page in Joomla many times before: http://docs.joomla.org/How_to_add_CSRF_anti-spoofing_to_forms Now I want to implement the same mechanism using the Joomla ...
5
votes
2answers
764 views

Get access to php variable in Joomlas addscriptdeclaration for Javascript

How do I get access to php variables in Joomlas approach to integrate Javascripts with addScriptDeclaration? $document = JFactory::getDocument(); $variable = "test"; $document->...
4
votes
2answers
9k views

All directories listed as unwritable

Previous title: Can't install extensions: Error: Archive does not exist I removed and reinstalled Joomla 3.3.6 on my CentOS 6.5 server. Wanted to install some backup utilities and a CCK. However i'm ...
3
votes
3answers
2k views

Retrieve joomla session from within a module

I'm setting a session variable from external file using ajax: define( '_JEXEC', 1); define( 'DS', DIRECTORY_SEPARATOR ); define( 'JPATH_BASE', realpath(dirname(__FILE__) .'/' ) ); require_once ( ...
2
votes
1answer
149 views

Joomla sessions within a loop passing only a single value

I need to pass some variables from one PHP module to another PHP module within a loop and at the same time display the module multiple times as well. I use Joomla sessions for passing variables and ...
1
vote
1answer
891 views

How Templates work and load css/js files? Website building process with Purity III

Unfortunately I can't find any info on how the purity iii template really works. I have to present my website tomorrow and I may get asked "where does the content come from?" and I can not answer ...
1
vote
2answers
6k views

Strict Standards error after PHP upgrade

I am using Joomla 3.3.6 site on VPS, yesterday my hosting provider upgraded from PHP 5.3.29 to PHP 5.4 and now i am getting following errors on my live site: We asked them to revert back to php 5.3....
11
votes
1answer
128 views

Docs use assign by reference (=&) but is this necessary with PHP 5?

I've noticed in the Joomla documentation, such as for JFactory/getSession, that the examples use assign-by-reference (=&), rather than a simple assignment (=). $session =& JFactory::...
6
votes
2answers
1k views

Joomla PHP does not match host PHP

I'm brand new to web development and I've installed Joomla on my website. For whatever reason I can hardly do anything because my PHP version is only 5.3 according to Joomla. However, using my cpanel ...
6
votes
2answers
2k views

Joomla! JFactory::getDate wrong

According to the documentation JFactory/getDate $tzOffset default value is 0. However, the following example: $date_default_offset = JFactory::getDate('now'); echo $date_default_offset->toRFC822(...
5
votes
2answers
2k views

Using caching for module or component independently

Is it true that even if i enable module caching from module setting, module caching not works unless system cache plugin turned on? I want to use cache per module/component from their settings not ...
5
votes
1answer
896 views

How can I change a SEF URL to display another template?

I am using Joomla 3.3 and K2 v2.6.9. I have a category view with several items, namely books. The URL looks like this: http://localhost/index.php?option=com_k2&view=itemlist&task=category&...
4
votes
1answer
250 views

Question about Server Timezones and J!3.5 Extentions

Background My business website is using an appointments scheduler/shopping cart called VikAppointments so my dates/times are very important for smooth business operation. My Timezone is Central ...
3
votes
2answers
2k views

PHP Fatal error: Class 'ContentHelperRoute' not found

I am getting this line in the error_log of a Joomla! 3.6.5 site every so often: [21-Dec-2016 18:29:41 America/Detroit] PHP Fatal error: Class 'ContentHelperRoute' not found in /path/to/site/...
3
votes
2answers
530 views

SMTP connect() failed, Cannot send mails

I have a vanilla Joomla installation. I installed RSForm plugin to send emails from Contact Us form. However, when the user fills out the form get the message: SMTP connect() failed I tried to ...
3
votes
1answer
349 views

Use of $_SERVER variables in custom plugin

In my Joomla application, I have functionality where I use server variables, like request_uri and query parameters for parsing url string. This function is used in many modules. So, I wanted to ...
3
votes
1answer
725 views

Register user via external script and a random password

I have this PHP script that I want to call from a mobile app, that registers an email address, uses a random password, and automatically activates & asks the user to reset the password upon first ...
3
votes
2answers
414 views

User group in joomla 3.2.1

Please help me. I have a problem about user group in joomla 3.2.1. I created a new user group(name: Hoa Si) then i create a new user(abc) for Hoa Si group. But i can not login with new user(abc) on ...
3
votes
1answer
59 views

Impossible to set my joomla site timezone to Pacific/Tahiti (hosted in UTC)

I have exactely the same issue like in this post. For a Joomla site online booking (Joomla + Yootheme + Vik Appointment) I need Pacific/Tahiti default timezone and I still have UTC despite all my ...
3
votes
1answer
2k views

Creating custom field type multiselect list - how to save the values?

I want to make a module that parses the manufacturers from virtuemart, and the user will select which manufacturers he wants to be shown in the index page. Its the first time I try to create a custom ...
3
votes
1answer
201 views

Display values of JFormFieldRepeatable

I am using a J3.x Plugin called Aixeena CCK http://extensions.joomla.org/extensions/extension/authoring-a-content/content-construction/aixeena-cck which adds extra fields to articles using standard ...
3
votes
1answer
248 views

Where to catch Post event?

I use the following JavaScript to open new window in which Joomla login page displayed: window.open('https://URL', '_blank', 'location=yes'); The new window opens is as follows: I need to ...
3
votes
4answers
702 views

Override default php session

I'm building a AngularJs app using joomla in background. The AngularJs app get loaded once and then calls the server always through ajax. Some calls happen simultaneously. If I'm using the default PHP ...
3
votes
2answers
173 views

Check if INSERT query was successful or failed because of a duplicate UNIQUE KEY

I have a db-table called league where the mail column is the unique id: |name |mail | |Bryan|bryan@hotmail.com | I have a frontend where users can sign up and then I have this for ...
3
votes
1answer
2k views

How to use JFactory::getLanguage() from another directory?

How can I get the current selected language using the Function JFactory::getLanguage(); from another directory? I know how to do it when I am there: /web/include /web <---- [...
2
votes
2answers
103 views

How to fix broken link articles after upgraded from 1.5 to 3.6.5 Stable

I upgraded from Joomla 1.5 to 3.6.5 stable and now I have many broken link on articles. I can fix it manually one by one (I'm even fixing it) but my main concern is that the web site is a public one ...
2
votes
1answer
267 views

Correct ways to verify update query is successful under conditions

I was trying to find out correct ways to verify db update query is successful but some problems i am fetching. Even if update query($db->execute()) is not done/row does not exists.... but it ...
2
votes
1answer
129 views

Mixing PHP variables and JS variables in output

I am trying to develop a module to use JWPlayer's URL Toekn Signing (docs can be found here http://developer.jwplayer.com/jw-platform/reference/v1/content_signing.html) but I'm having an issue with ...