31
Programmers corner / PHP in HFS
« on: March 22, 2012, 02:56:33 AM »
Made it possible! It's not hard at all when you have a function to control command-line PHP and capture output
See the template on the right and the resulting output in Mozilla on the left.
Unfortunately you have to use $args to pass variables into command line PHP, and running it like this clearly removes the possibility of running SMF or something.
Change "C:\program files\FHFS\php-bin\php.exe" in the script below to your correct PHP path, and place it under [request] in hfs.events.
See the template on the right and the resulting output in Mozilla on the left.
Unfortunately you have to use $args to pass variables into command line PHP, and running it like this clearly removes the possibility of running SMF or something.
Change "C:\program files\FHFS\php-bin\php.exe" in the script below to your correct PHP path, and place it under [request] in hfs.events.
Code: [Select]
{.set|php|{:{.if|{.exists|$1.php.}|{:{.exec|"C:\program files\FHFS\php-bin\php.exe" -n -f "C:\Program Files\FHFS\$1.php" $2|out=out.}:}|{:{.exec|"C:\program files\FHFS\php-bin\php.exe" -n -r "$1"|out=out.}:}.}{.^out.}:}.} {.comment| PHP FUNCTION $1 IS SCRIPT FILENAME OR DIRECT COMMANDS, $2 IS ARGUMENTS TO PASS IF SCRIPT FILE .}