marty.net 1001 Postcards Love Love Love Meep Meep ZenZodiac DailyQuotation

YOU ARE HERE:
Including PHP files into template?

HOME

CPSHOP|

|

|

EMAIL MARTY
  marty.net message board
  « Including PHP files into template? »
Welcome, Guest. Please Login or Register.
12/14/17 at 08:09:37
Home Help Search Login Register
   marty.net message board
   About cpshop
   Customization Help
   Including PHP files into template?
(Moderator: Marty)
Pages: 1 Reply Notify of replies Send the topic Print 
   Author  Topic: Including PHP files into template?  (Read 888 times)
flippinsweetgear
Gold Dragon
****

Posts: 171



Go Scots!
   

WWW
Including PHP files into template?
« on: 04/08/08 at 02:11:12 »
Reply with quote Modify message

Hello all,
I have wanted for quite awhile now to be able to successfully include various php scripts into my template.  I currently use iframes for certain dynamic content which works fine, but now I want to try and implement a rating/commenting script to make it a little more 2.0.  

Has anyone had any success in including php?  I have my template saved as a php file and still will not show love for any php file I try and include.

This is the rating script I am dying to get up and running -
http://www.masugadesign.com/the-lab/scripts/unobtrusive-ajax-star-rating-bar/

TIA!
« Last Edit: 04/08/08 at 02:42:13 by flippinsweetgear » Logged

Flippin Sweet Gear | Kids T-shirts | Big Lebowski Shirts
brattytees
Gold Dragon
****

Posts: 439



ack!
   

Re: Including PHP files into template?
« Reply #1 on: 04/08/08 at 06:08:02 »
Reply with quote Modify message

I use lots of php in my templates


Code:
<?php include("directory_templates_are_in/include_files/file.php"); ?>



Quote:
I have my template saved as a php file and still will not show love for any php file I try and include.


So what happens?
Logged
flippinsweetgear
Gold Dragon
****

Posts: 171



Go Scots!
   

WWW
Re: Including PHP files into template?
« Reply #2 on: 04/08/08 at 12:37:30 »
Reply with quote Modify message

With having my template saved as .php and the permissions set to 644 it seems to just output the include line as text.  It just won't include the php file.  I always thought it had something to do with cpshop's output converting it to text/html or something like that.  Is there a change that I'm missing that needs to be done?  Thanks Bratty!

UPDATE: I accessed my template directly and that worked fine.  So there must be something within cpshop that I need to change to make it happen right?
« Last Edit: 04/08/08 at 12:46:14 by flippinsweetgear » Logged

Flippin Sweet Gear | Kids T-shirts | Big Lebowski Shirts
keeb
White Dragon
**

Posts: 20



Go Scots!
   

Re: Including PHP files into template?
« Reply #3 on: 04/08/08 at 17:43:48 »
Reply with quote Modify message

Have you had any success with this issue?

I'm was having the same troubles.

Now I'm having different troubles (see below).  It seems i can only use php with the general tempalte, and not with a customized template from a "cpfilter_template"  

Check out the end of this post:
http://www.marty.net/cgi/marty/board/messageboard?board=cpperl&action=display&num=1134587475&start=9

Instead of listing a template's location:
home/public_html/etc.etc.

you list the template's URL:
http://www.mysite.com/cooltemplate.php


However, this only works for me with regard to the general producttemplate.php and the thumbnailtemplate.php

All of my custom templates that I use with filters (e.g. cpfilter_template:http://www.mysite.com/pages/template1.php)

fail to process the php includes.  The includes are just listed in the html of the page without ever being processed.

Eeeks!  
Logged
flippinsweetgear
Gold Dragon
****

Posts: 171



Go Scots!
   

WWW
Re: Including PHP files into template?
« Reply #4 on: 04/08/08 at 18:57:37 »
Reply with quote Modify message

Ah ha!   That is what I needed to know!  That worked great for me, an absolute link to the cpshop templates.  Oddly enough the  problem that you are experiencing is working fine for me (cpfilter_template:http://www.mysite.com/pages/template1.php)

Thanks a lot for pointing me in the right direction!
Logged

Flippin Sweet Gear | Kids T-shirts | Big Lebowski Shirts
keeb
White Dragon
**

Posts: 20



Go Scots!
   

Re: Including PHP files into template?
« Reply #5 on: 04/08/08 at 19:03:05 »
Reply with quote Modify message

You're welcome!

If only you were a coding guru and could help me figure out why i can't use PHP with my filter templates!

Logged
brattytees
Gold Dragon
****

Posts: 439



ack!
   

Re: Including PHP files into template?
« Reply #6 on: 04/09/08 at 05:36:09 »
Reply with quote Modify message

Yeah, you have to enter it into cpshop as a fully-qualified URL, instead of a file location. Sorry, should have added that above.

As for the filter issue, I don't use them like that, so I'm not sure what's going on there.
Logged
keeb
White Dragon
**

Posts: 20



Go Scots!
   

Re: Including PHP files into template?
« Reply #7 on: 04/09/08 at 08:30:40 »
Reply with quote Modify message

Well, my temporary fix for the PHP with filter templates issue is...

I make the default cptemplate file blank except for <[content]>  And then I use a regular PHP file that has an include for the .cgi file (http://www.mysite.com/store/index.cgi/shirts).

Since the PHP file is only including the thumbnails from <[content]>, the PHP template can look however I want.

I'm not sure if this even takes longer than the normal way...seems to work fine.

*******************
UPDATE
*******************

There's a major flaw with doing my above workaround...

The mysite.com/store/index.cgi page is empty...DUH!  Wow.

Well, it's not EMPTY per say, rather it just lists all of my cpshop ID's and links to them.

*sigh*

Why won't my cpfilter_templates use php templates?

And another sigh, and cry for help...
« Last Edit: 04/10/08 at 23:17:12 by keeb » Logged
Pages: 1 Reply Notify of replies Send the topic Print 
Jump to:


marty.net message board (http://www.marty.net/cgi/marty/board/messageboard)

Powered by YaBB 1 Gold - Release (Yet Another Bulletin Board)
Copyright 2000-2001, X-Null. All Rights Reserved.