What are the fundamentals in integrating ShopSite with PHP? Someone
mentioned to me that this was possible.
What are the fundamentals in integrating ShopSite with PHP? Someone
mentioned to me that this was possible.
What are the fundamentals in integrating ShopSite with PHP? Someone
mentioned to me that this was possible.
Greetings,
PHP is very easy to integrate into ShopSite, and even moreso if you know the
PHP language beforehand.
We recently converted one of our client websites to PHP. The problem was
that there were hundreds of pages, each with hard-coded links (using text3
on left side template) to foo.html (instead of foo.PHP, as they now would be
named) Did we want to manually edit each and every page to change the .html
extension to .PHP? NO! The solution was to write a simple .htaccess file
that would dynamically rewrite any request for a file named "foo.html" to
actually request the file named "foo.PHP". This solution assumes that your
server has Apache and mod_rewrite installed.
RewriteEngine On
RewriteRule ^(.*)\.html$ $1 [C,E=WasHTML:yes]
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ $1.php [S=1]
RewriteCond %{ENV:WasHTML} ^yes$
RewriteRule ^(.*)$ $1.html
There is no reason NOT to have every page end with a .PHP extension. The
PHP processor is extremely streamlined, and can easily handle all but the
most extreme cases (like, if you have dozens of pages open/close/manipulate
large databases (MySQL or otherwise) simultaneously) You could even change
the way apache views PHP and HTML more fundamentally by adding the following
lines to your .htaccess file (again, assumes you're running Apache.) This
makes it so that Apache will use the PHP module to process every page,
regardless if it contains PHP or not.
AddType application/x-httpd-php .html
AddType application/x-httpd-php .htm
As Loren suggests, and as Brandon Eley mentioned in a previous post, you can
integrate PHP into the custom template pretty easily. Check out his
excellent template at http://www.2bigfeet.com/template.php (I hope you don't
mind that I quoted your previous post, Brandon)
"Loren" <loren_d_c@yahoo.com> wrote in message
news:3CC4C52C.AC521566@yahoo.com...
The basic requirement for a PHP page is simply that it be named with a
.php extension, which is easy enough in ShopSite. What you do after that
depends on how complicated your PHP code is and what part of the page
you want it to interact with. If you just want to include a PHP footer,
then you could put the PHP include code in the Universal Footer (note
that this would then be on all of your pages, unless you turned off the
Use Universal Footer in the non-PHP pages). If you just want standar PHP
fields in other sections of the page, then you could place the PHP code
in the Text 1, Text 2, and Text 3 fields in the Page Contents. You could
also place PHP code in the Product Description and More Info Page text
field.
On the other hand, if you want to do something more complex like
interact with other page and product elements, then you would want your
PHP code in the custom template. For example, if you wanted to have your
product display an Out of Stock graphic instead of the usual order
button whenever the product is out of stock based on your own SQL
inventory database, then this could be accomplished with PHP code in the
product template (note that the page the product is assigned to would
have to have the .php extension for this to work).
I think you can even have pages with the .php extension and no PHP in
them, just plain HTML, although this probably increases your server load
unnecessarily because the webserver would need to inspect each document
for PHP code before serving up the page.
-Loren
Dennis Moore wrote:
What are the fundamentals in integrating ShopSite with PHP? Someone
mentioned to me that this was possible.
Users browsing this forum: No registered users and 29 guests