PHP Includes on Cart, Search, Customer Registration

General ShopSite user discussion

PHP Includes on Cart, Search, Customer Registration

Postby denverrusty » Wed Aug 20, 2008 3:59 pm

The shopping cart, search, customer registration and customer account all use a ShopSite CGI module which doesn't allow me to embed a PHP include into the template so that I can use standard headers, nav and footers in ShopSite and the content management system we are using (Drupal). The includes work fine on product pages. Any ideas on how I can include something into these templates and not duplicate all of the HTML?
denverrusty
 
Posts: 6
Joined: Thu Mar 27, 2008 3:49 pm
Location: Denver, Colorado

Postby Jim » Wed Aug 20, 2008 4:05 pm

Have you tried the template tag [-- INCLUDE xx --] where xx is the name of the file containing the html you want placed at that point in the template? Note the the file must be in the templates/include directory for this to work.
Jim
Site Admin
 
Posts: 4953
Joined: Fri Aug 04, 2006 1:42 pm
Location: Utah

I may try the CALL program.cgi

Postby denverrusty » Wed Aug 20, 2008 8:57 pm

I forgot to mention that the navigation is dynamically generated so the shopsite include will not work for this. I can use PHP to do it but not on the CGI pages. I guess I would need to call a PERL program that calls a page with PHP.
denverrusty
 
Posts: 6
Joined: Thu Mar 27, 2008 3:49 pm
Location: Denver, Colorado

Success using ShopSite Call

Postby denverrusty » Thu Aug 21, 2008 11:31 am

I wrote a PERL program that pulls up a PHP page that has the includes needed to dynamically generate the navigation. It works great.

Here is the PERL code for anyone else who needs to do this:

#!/usr/bin/perl
use LWP::UserAgent;
use HTTP::Request;

my $agent = LWP::UserAgent->new(env_proxy => 1,keep_alive => 1, timeout => 30);
my $url = "http://yourdomain/shop/includes/dynamic_body.php";
my $header = HTTP::Request->new(GET => $url);
my $request = HTTP::Request->new('GET', $url, $header);
my $response = $agent->request($request);

if ($response->is_success){
print $response->content;
} else {
print '<FAILED></body></html>';
}
denverrusty
 
Posts: 6
Joined: Thu Mar 27, 2008 3:49 pm
Location: Denver, Colorado


Return to User Forum

Who is online

Users browsing this forum: No registered users and 71 guests