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.

Filter by
Sorted by
Tagged with
0 votes
2 answers
36 views

How to conditionally display custom fields in template overrides

I am using the following code to pull in some custom fields into an override of com_content > category > blog_item.php: $video = $this->item->jcfields[4]->value; $media = $this->item-...
Mike Hermary's user avatar
1 vote
1 answer
39 views

Which line should PHP files in Joomla start with?

I know, that the first line in PHP Files is because of security reasons. I read it here: https://docs.joomla.org/Why_do_most_of_the_Joomla!_PHP_files_start_with_defined(%27_JEXEC%27)%3F But in the ...
agi's user avatar
  • 303
0 votes
0 answers
16 views

Can't install Antispam plugin by CleanTalk in Joomla3.8

I'm trying to install . Once the install button is clicked, I keep waiting and nothing happens. Upon checking the DevTools Console, there are errors stating: Uncaught Reference Error: jedpps-...
pal's user avatar
  • 1
1 vote
1 answer
35 views

Export as Excel with PHPSpreadsheet as download how to keep Joomla Messages?

In my custom Joomla 5 component I've added PHPSpreadsheet via composer. In the Export View (Backend) i have a small adminform for setting up the export and a submit button that toggles the download by ...
Marco's user avatar
  • 583
0 votes
0 answers
21 views

How to handle duplicate items coming from an external JSON API and being imported as article content

I have adapted working code from Joomla 3 and the CLI to Joomla 4/5 and the API. The core functionality using the API system is working, but I am struggling to find a replacement for checking for ...
Mike Hermary's user avatar
0 votes
0 answers
23 views

The PHP temporary folder is not writeable

On Joomla 5 (same problem on Joomla 4) I am getting the warning "The PHP temporary folder is not writeable". In more detail: This folder is not writeable by the Joomla! instance, which may ...
Bruce Button's user avatar
0 votes
0 answers
33 views

How to configure PHP-FPM to run Joomla without setting $live_site in configuration.php

I've spent a good few hours ploughing through code and setting up servers to test exactly what is goes on to cause Joomla to fail in PHP-FPM unless $live_site is correctly set. The problem turns out ...
mbrampton's user avatar
  • 314
0 votes
1 answer
43 views

How do I override Joomlas default field template, but just in my component?

Is it possible to override the default field template just in my component? How would I go about doing it? The template I specifically want to override is "joomla.form.renderlabel", which is ...
Obscerno's user avatar
  • 191
0 votes
1 answer
24 views

Styling Joomla custom fields

0 i have created some custom fields in Joomla and created an over-ride: /components/com_fields/layouts/field/render.php to /templates/YOUR_TEMPLATE/html/layouts/com_fields/field/MY_OVERRIDE.ph ...
user408's user avatar
  • 33
0 votes
1 answer
83 views

Joomla 4 custom template not loading web assets

I am in the process of writing a custom theme for a client and am having issues with the Web Asset Manager. I have been following examples of other templates that are built for Joomla 4+, but I must ...
Mike Hermary's user avatar
2 votes
1 answer
275 views

How can I filter the Persian alphabet in PHP for Joomla 4?

Before anything, I must say this code works as well for the English language, but in Persian it never works. I use this code on model/celebrities.php. This code shows my frontend model: class ...
Ali Zangeneh's user avatar
0 votes
1 answer
57 views

My script doesn't work on joomla 4

I used this simple php gallery from a folder on my Joomla 3 site. Now I'm getting ready to do an update to Joomla 4 and I noticed that I have a problem with displaying images from the directory. if I ...
Midhat's user avatar
  • 99
1 vote
1 answer
86 views

Standalone PHP script to get username in Joomla 4?

In Joomla 3 I used the following code. What do I need to change to use it with Joomla 4? <?php define( 'DS', DIRECTORY_SEPARATOR ); $rootFolder = explode(DS,dirname(__FILE__)); //current level ...
yowww23's user avatar
  • 11
0 votes
1 answer
44 views

Upgrade Joomla CLi script to handle bulk import of items into articles

I am upgrading a client's CLi script that is used to automatically bulk import news items into Joomla articles. The code was originally programmed for Joomla 3 and now needs to support Joomla 4. I ...
Mike Hermary's user avatar
0 votes
1 answer
57 views

PHP load class from namespace error

I have been using this doc to convert a client's CLi news import script from Joomla 3 to 4. The code has been stripped of all the JSON to article code for brevity. I have gone over all of my code and ...
Mike Hermary's user avatar
0 votes
1 answer
73 views

PHP: Need to know how to trigger onContentAfterSave on existing article

I have what I thought would be a simple challenge: to automate publishing an article and trigger the onAfterContentSave event for saving the article. This code ultimately has to run within another ...
Bruce S's user avatar
2 votes
1 answer
78 views

Filling custom fields when creating an article with an script via the API

I am creating an article in Joomla 4 using the excellent code that is suggested here: Joomla 4 create article programmatically My task is write the values of the custom field simultaneously with the ...
Igor K.'s user avatar
  • 23
0 votes
0 answers
48 views

How to resolve the Internal Server Error with my custom components calendar in Joomla 4?

I try to make a custom calendar in my custom component in Joomla 4. For that I write a code who connect to a database and retrieve the data. For that I have 3 files : default.php, ...
Sephirah's user avatar
0 votes
2 answers
53 views

Joomla PHP Framework problems. White page, no errors

I've upgraded a Joomla 3.10 website to 4.x. I use custom scripts on the website wich use the framework and that worked fine until after the upgrade. I did some searching and since the framework got an ...
Martin Law's user avatar
0 votes
1 answer
46 views

Joomla component loading throws exception

I'm working on a Joomla 4 website which is migrated from Joomla 3.11. Everything else is working fine except one page. These page is also rendered and further it loads data from a ajax request from ...
Ramesh Jangra's user avatar
0 votes
1 answer
146 views

getMailer gives "Failed to start application" exception after updating to Joomla4, how do I fix it?

The issue Quoting (again) from an old question of mine: I have a form in my Joomla! site. Once completed, the form should send an e-mail but only if some conditions have been met. Not having been ...
Firefighter's user avatar
1 vote
1 answer
76 views

Plugin Events - how are they helpful in a real life?

There's a knowledge base for one Joomla component and it contains a whole bunch of Plugin Events. Text files with a code, basically. I wonder how they can be used in a real life an what for? Would it ...
papakota's user avatar
1 vote
0 answers
31 views

Where are the Joomla tests located, and how can I include them in my CI/CD pipeline?

I am trying to set up a CI/CD pipeline for a Joomla project and would like to include tests for my Joomla components. I am looking for the location of the Joomla tests and how I can integrate them ...
DeesreX's user avatar
  • 87
1 vote
1 answer
43 views

How implement the PHP strip_tags in the Joomla 4-file com_content/archive/default_items.php

In Joomla 4.3.1, I've made an override of the com_content/archive/default_items.php Now I want to strip tags and display the string (text from article) as one line <p> only. Without any ...
TorbjörnN's user avatar
0 votes
0 answers
28 views

RSform: How to skip strings in query output if variables are empty?

I have this Code. I don't know PHP, but I got the result I wanted. Almost. As you can see, the output will include empty URL parameters if none are provided. Some fields will always be filled, others ...
getimo's user avatar
  • 9
2 votes
1 answer
181 views

How can I query a custom field value in JavaScript?

I am creating a website for a composer to include a page in a blog style with YouTube videos of concerts. I am attempting to block all the code for the videos from automatically loading on the page (...
Gillian's user avatar
  • 411
0 votes
1 answer
48 views

"0 - syntax error, unexpected end of file" after transfering my site to another hoster

I recently transfered my domain from strato to netcup. I installed a fresh joomla 4 and installed my template (custom written). The Issue is I get the error: "0 - syntax error, unexpected end of ...
Jonathan Schmidt's user avatar
1 vote
1 answer
32 views

No response from Joomla plugin that should receive AJAX calls

I followed this guide step by step and I've just created a plugin that should elaborate AJAX calls received from a form in the front-end, so that the data sent by every user will be structured and ...
smarmolena's user avatar
0 votes
0 answers
65 views

Joomla 3 Custom PHP Script needs to be updated for Joomla 4

I have a custom php script that was written for a Joomla 3 site. Of course on Joomla 4 it doesn't work. I've been working on re writing the query statements to use prepared statements but even with ...
hpgodwin's user avatar
1 vote
1 answer
32 views

Dynamic Title Module Control

I'm using PHP to creata dynamic page title based on the menu item using Sourcer and the following PHP: <?php $active = JFactory::getApplication()->getMenu()->getActive(); echo $active->...
John S's user avatar
  • 11
0 votes
0 answers
44 views

Filtering Data in Php oop

After I click the search button - there's no data output in the web page. What should I do? This is my view page <label>DATE FROM:</label> <input type="date" ...
pal's user avatar
  • 1
1 vote
1 answer
113 views

How to print a php variable to the browser's console?

So within administrator function. echo("<script>console.log('PHP: " . $data . "');</script>"); It seems it doesn't insert the js script on the page. This works from a ...
Plamen's user avatar
  • 745
0 votes
0 answers
32 views

Article slideshow

I wanted to use Bootstrap 5 carousel/sildeshow on my Joomla CMS v4. I recently updated to Joomla 4 and the previous slideshow component isnt compatible so I am left with a load of articles which ...
j00m's user avatar
  • 181
1 vote
0 answers
121 views

Adding a Tag to an Article (in PHP)

In J4, when I want to set a value to a Custom Field, I use the following code and it works fine: $model = new FieldModel(array('ignore_request' => true)); $model->setFieldValue(2, $item->id, '...
Marc Dechèvre's user avatar
2 votes
0 answers
78 views

SimpleXML load file error for cli PHP script

I am using the following code in the Joomla Cli to import news items into articles on a client's website. It was working perfectly until yesterday when an error was reported and no news items were ...
Mike Hermary's user avatar
0 votes
1 answer
216 views

Display current article's specific custom field in module

Im using Joomla 4. And for some reasons I need to publish my articles with joomla 4 custom html module that shows specific custom fields of current article. I have changed mod_custom's default.php ...
okisan's user avatar
  • 55
1 vote
2 answers
65 views

How do I create a new PHP variable for a blog override from the result of JDatabase join query?

In a category blog override I am attempting to reflect the featured status of an article. In order to find out whether it is currently actively featured - i.e. not 'pending' or 'expired' I am querying ...
Gillian's user avatar
  • 411
1 vote
1 answer
79 views

After joining two tables in phpMyAdmin how do I save the results as a dynamic table?

In order to query the exact featured status of an article in a blog override (i.e. currently featured, not pending or expired or not featured at all) I have created a query to join two tables and ...
Gillian's user avatar
  • 411
1 vote
1 answer
66 views

Where is Joomla's ServiceProviderInterface

I am working my way through a Joomla 4 component tutorial. I have setup Visual Studio Code's Intelephense to be able to find Joomla classes using includepath. That seems to be working fine for the ...
Jimmy's user avatar
  • 307
1 vote
1 answer
431 views

500 Layout default not found. (Joomla 4)

I am trying to make a music component for Joomla 4 On the backend, my other forms work fine and the data is stored correctly in the database ( celebrity , album , etc...) In the music form, when I ...
Ali Zangeneh's user avatar
1 vote
2 answers
62 views

Insert datetime type into created column from PHP file from module/component

I can't get the created column filled when inserting items into the database. I am using this code: function createRecordInLSFCDBTable($id, $userId) { echo 'createRecordInLSFCDBTable: ' . $id . ',...
purple11111's user avatar
1 vote
1 answer
40 views

Modifying email address through PHP

I'm using Regular Lab's sourcerer to embed code in an article to modify users' email addresses once a questionnaire has been completed (anonymization). I used this code to no avail: $user = JFactory::...
Vlad's user avatar
  • 21
0 votes
0 answers
116 views

Using Like with wildcard in joomla php query

Hi I am struggling to get an output from a wildcard query. I am using the following code which outputs the following error: 0 Unknown format specifier "$" $iban = '...
OnTarget's user avatar
0 votes
0 answers
58 views

php beginner: handling array in Joomla module

Newbie in php, I am trying to create a module to extract orders from Joomla database and plot monthly results as a yearly curve. I am trying to store first the products in an array, followed by a ...
Phil91's user avatar
  • 31
0 votes
2 answers
44 views

New to Joomla and my site needs critical updates. HELP!

I'm new to Joomla and the site I'm taking over needs critical updates and has for some time. It needs 14 extension updates, and I'm getting this message: Your site is currently using PHP 7.2.2. This ...
Henry Chisholm's user avatar
0 votes
2 answers
52 views

joomla php notice error of only variable should be passed in

Hi Getting php notice error of only variable should be passed in $this->assignRef('CatList' , $modelUsedcar->loadMainCat($brand,$Carmodel)); Can anyone suggest on how to make this function ...
Ruchika's user avatar
  • 415
1 vote
0 answers
48 views

workable php 7.4 function in joomla 3.10 is working weird in php 8.0

Am displaying list of news haviing Date News Heading Short Descrption The list is spread to around 100 pages, having 20 news in each page Issue is: This is working absolute fine in php 7.4.x in ...
Ruchika's user avatar
  • 415
2 votes
1 answer
212 views

Show button for each iteration of foreach loop

I have built a module using Joomla's subform XML. The XML in the subform is <fieldset name="topics" label="Topic"> <field name="title" type="text&...
RustyJoomla's user avatar
  • 2,076
1 vote
1 answer
39 views

PHP script to clear cache in Joomla 3.x

I created the following script and put it to cron job on server. Unfortunately it does not work. include 'includes/defines.php'; include 'includes/framework.php'; $conf = JFactory::getConfig(); $...
Clipart - Designer's user avatar
2 votes
1 answer
3k views

Joomla 3.10 admin not working after upgrade to PHP 8

My provider has upgraded the PHP version from 7.4 to 8.1. I'm working with Joomla 3.10 and thought that no actions were needed since PHP 8 is recommended for Joomla 3.10. Since the upgrade was done, I ...
Yves Parrat's user avatar

1
2 3 4 5
16