Running PHP Scripts in Includes

Questions and answers about ShopSite Custom Templates

Running PHP Scripts in Includes

Postby bwokich » Fri Oct 28, 2011 9:40 am

I'm trying to call a PHP script from inside an include. I have my include named FILENAME.php and am then including it with [-- INCLUDE FILENAME.php PROCESS --]

The include's a simple hello world at the moment.

Code: Select all
<?php echo 'hello world';?>


The PHP is appearing in the source of the markup without being interpreted.

Any advice on what I'm doing wrong?

Bryan
bwokich
 
Posts: 5
Joined: Tue Oct 18, 2011 10:33 am

Re: Running PHP Scripts in Includes

Postby loren_d_c » Fri Oct 28, 2011 9:47 am

ShopSite does not process PHP code, that is up to your webserver. Is the page that the PHP code is showing up on named with a .php file extension? Some servers require this in order for them to process the PHP code. Note that PHP will not work in the shopping cart, search, gift certificate, or customer registration pages, these are .cgi pages and the webserver will not parse the output of .cgi's for PHP code.

-Loren
loren_d_c
 
Posts: 2571
Joined: Fri Aug 04, 2006 12:02 pm
Location: Anywhere

Re: Running PHP Scripts in Includes

Postby bkerns » Wed Nov 20, 2013 10:31 pm

I believe you can enable PHP to run in HTML docs by adding a type or handler to your .htaccess:

AddType application/x-httpd-php .html .htm
or
AddHandler application/x-httpd-php .html .htm

-Brian
bkerns
 
Posts: 16
Joined: Wed Nov 20, 2013 2:07 pm


Return to Custom Template Questions

Who is online

Users browsing this forum: No registered users and 11 guests

cron