Forums

PHP does not work as it worked in V6

Ron 19 Dec, 2024

Hello

I have this code, which worked in V6, but it doesn't seem to work in V8.  I don't get any fault in debugging.  

require_once( 'com' . DS . 'com_price' . DS . 'prices' . DS . $this->data[ 'area1' ] . '.php' );

Any suggestions

Thanks

Ron

Max_admin 20 Dec, 2024
Answer

You should use an absolute path which starts with a slash or DS and provide the full absolute path, you can use $this->root_path to get the Joomla root path

Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Ron 21 Dec, 2024

Hello Max.

Thanks for replying. I have a php code in the form Action the var of which is collected by a field named "area1".  The PHP code works okay but does not get picked up by the code above.  The PHP code is named "get_area" in the field default value I have {var:get_area}.

Thanks

Max_admin 21 Dec, 2024

you need to return a variable from the PHP action to get the value in {var:get_area}, withe the "require" you will not get any values, the require will just print some output, or if there are functions then you may call them after the require, it depends on the code you have in that file

Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
You need to login to be able to post a reply.