-
-
Notifications
You must be signed in to change notification settings - Fork 12
10. Custom PHP file
JoomlaBoat edited this page Dec 6, 2021
·
12 revisions
You can have a custom php file that will have a function to be executed when users save, refresh, publish or unpublish records.
Create a new .php file and save it into /components/com_customtables/customphp
A special named function from this file will be executed.
Lets call the file "myfirsttable.php" for example.
The file must contain a function "ESCustom_myfirsttable" where "myfirsttable" is the name of the file.
Example:
`function ESCustom_myfirsttable(&$row, &$row_old){`
`if(isset($row['id'])){`
`$db = JFactory::getDBO();`
`$query='UPDATE #__customtables_table_exployee SET es_firstname='.$db->quote(strtolower($row['es_firstname'])).' WHERE id='.$row['id'];`
`$db->setQuery( $query );`
`if (!$db->query()) die( $db->stderr());`
`}`
`}`
Save it. Upload to your website's folder: /components/com_customtables/customphp
Then go to the back-end:
Components/Custom Tables/Tables
Select the table and click on "Advanced" tab, then select the Custom PHP file.
