Problems, need help? Have a tip or advice? Post it here.
3 posts Page 1 of 1
Hi All,

We have created a PHP script that when it is executed it runs a Python Script.
I am Just wondering whether anyone knows if it is possible to run a php script via a button in the admin area of couchcms?! As we want a customer to activate the script.

Any help would be amazing.

Cheers.
This I suppose will give you a good detailed insight for adding to the stuff admin panel
Data Tables by @trendoman

Then once you have your button on the admin screen you can do:
1. You can't put a variable in a single quote string, unless that is what you actually want. Instead, either break out and concatenate, or use double quotes:
Code: Select all
<cms:php>
    exec('/usr/bin/python3 /var/www/python_test.py "' . $input_val . '"');
</cms:php>


OR
2. This code presumes you actually type the double quotes in the terminal
Code: Select all
<cms:php>
    exec("/usr/bin/python3 /var/www/python_test.py \"$input_val\"");
</cms:php>


OR

3. If you want to get rid of double quotes, you can use either from below:
Code: Select all
<cms:php>
    exec('/usr/bin/python3 /var/www/python_test.py ' . $input_val );
</cms:php>

OR

<cms:php>
    exec("/usr/bin/python3 /var/www/python_test.py $input_val");
</cms:php>


Hope this helps you start.

Regards,
GenXCoders
Image
where innovation meets technology
Thankyou so much. That helps me out a lot.
3 posts Page 1 of 1
cron