Home News Contact Us Forum About Us Demos Products F.A.Q.
Shopping Cart
You currently have 0 items in your cart.


Recent Events
  • 31/12/2023 New Year SALE

    We are glad to announce New Year SALE. 25% discount for all our extensions. Use NY24 coupon code. Hurry up the discount is valid till 7 January.

  • 21/11/2023 BLACK FRIDAY 23 is coming

    BIG SALE, 35% discount for all our extensions. Use BF23 coupon code. Hurry up the discount is valid till 27 November.


2Checkout.com, Inc. is an authorized retailer of goods and services provided by ARI Soft. 2CheckOut




Follow us on twitter



Welcome, Guest
Please Login or Register.    Lost Password?

PHP variables
(1 viewing) (1) Guest
Go to bottomPage: 1234567
TOPIC: PHP variables
*
#20101
PHP variables 12 Years, 7 Months ago Karma: 5
Is there any way to include php variables within the SQL Query.
If not from the module itself can variables be added to file of the module?

I need an ARI data table to load based on a variable table name for example:

SELECT * FROM table_name_$variable

thanks

I forgot to mention I have the DirectPHP plugin enabled to allow for php code to be entered in articles as well as modules

If this is not possible would ARI smart content be a solution to intergrate php with ari data table?
Last Edit: 2011/09/28 19:09 By trevor_stp.
The administrator has disabled public write access.
 
#20103
Re:PHP variables 12 Years, 7 Months ago Karma: 747
Hello,

The module doesn't support this ability, but if you want to add it, modify the next file:

<joomla_directory>\modules\mod_aridatatables\includes\kernel\DataTables\Models\class.DataTablesDataSqlModel.php

See "prepareQuery" method.

Regards,
ARI Soft
The administrator has disabled public write access.
 
#20111
Re:PHP variables 12 Years, 7 Months ago Karma: 5
It works. Exactly what I needed!

thank you
The administrator has disabled public write access.
 
#20555
Re:PHP variables 12 Years, 6 Months ago Karma: 0
Hi trevor,

sorry to bother you mate but your post here was also a topic in which i am interested. Trouble is, I'm just getting up to speed with PHP, and also with joomla. I have a bit of programming experience, but not in web technologies.

Can I pass variables to the php code in DirectPHP via the url, then make a call from DirectPHP to display an ari data table based on that variable?

What should i change in prepareQuery?

Sorry if i've misunderstood.
The administrator has disabled public write access.
 
#20558
Re:PHP variables 12 Years, 6 Months ago Karma: 5
hugomc

you will have to define your variable within the file:

<joomla_directory>\modules\mod_aridatatables\includes\kernel\DataTables\Models\class.DataTablesDataSqlModel.php

as fillows:

function prepareQuery($query)
{

$db->setquery("SELECT column_x FROM table_x WHERE column_x ='y'");
$VARIABLE = $db->loadresult();



$params = array(

'VARIABLE' => $VARIABLE
);

you'll need to add "," at the end of the $VARIABLE if it is not your last parameter.

You should then be able to use your variable within your sql query by using the following: {$VARIABLE}

please back up your core ARI files and ask ARI Soft premission before changing any of the module files

hope this helps

trevor
Last Edit: 2011/10/11 03:09 By trevor_stp.
The administrator has disabled public write access.
 
#20559
Re:PHP variables 12 Years, 6 Months ago Karma: 5
you may also want to look into the {$REQUEST} feature available for ARI Data tables. This will also allow you to load an ari data table based on parameters within the URL
The administrator has disabled public write access.
 
Go to topPage: 1234567