Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: Trying to use a php include within my template file.  (Read 7265 times)

0 Members and 1 Guest are viewing this topic.

dRfruitLOOP

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 34
Trying to use a php include within my template file.
« on: June 22, 2004, 10:43:14 pm »

For some reason when I add the php include code to my template file it doesn't work at all. It pulls up nothing. I'm trying to add the navigation bar I use on all the other pages of this site to the gallery but for some reason it would seem that it isn't processing the include. I use this very same code on other pages with no issue.

This is the code I use...
Code: [Select]
<?php include("http://www.flat-fish.com/lib/nav.php");?>
Let me know if it would help you to see the whole source template page.

Thanks in advance for any help. And sorry if this has been answered already, I looked and couldn't find anything that looked right for me.

« Last Edit: November 21, 2004, 07:35:21 am by GauGau »
Logged

Burpee

  • Contributor
  • Coppermine regular visitor
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 71
    • Vuurwerklook.com
Re: Trying to use a php include within my template file.
« Reply #1 on: June 23, 2004, 12:38:04 am »

For some reason when I add the php include code to my template file it doesn't work at all. It pulls up nothing. I'm trying to add the navigation bar I use on all the other pages of this site to the gallery but for some reason it would seem that it isn't processing the include. I use this very same code on other pages with no issue.

This is the code I use...
Code: [Select]
<?php include("http://www.flat-fish.com/lib/nav.php");?>
Let me know if it would help you to see the whole source template page.

Thanks in advance for any help. And sorry if this has been answered already, I looked and couldn't find anything that looked right for me.



You should link to the image with another kind of path, not with http://
For example:
Code: [Select]
<?php include("/user/usrname/public_html/lib/nav.php");?>It cannot add externally linked files to a template. It HAS to be on the same site as the template file.

dRfruitLOOP

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 34
Re: Trying to use a php include within my template file.
« Reply #2 on: June 23, 2004, 02:28:44 am »

Ok, I fixed the path. Now if you open the template page directly, it includes the stuff I want it to. It still doesn't work right when you view the gallery. I can't figure out what the problem is now.  ???
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47844
  • aka "GauGau"
    • gaugau.de
Re: Trying to use a php include within my template file.
« Reply #3 on: June 23, 2004, 05:43:34 am »

link?

GauGau
Logged

dRfruitLOOP

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 34
Re: Trying to use a php include within my template file.
« Reply #4 on: June 23, 2004, 07:53:41 am »

Gallery: http://www.flat-fish.com/gallery/

template: http://www.flat-fish.com/gallery/themes/default/template.php

As you can see, I added the list at the bottom of the page just as a test. I also altered the init.inc.php file to allow the template page to be a php file.
Logged

DaMysterious

  • Contributor
  • Coppermine frequent poster
  • ***
  • Country: nl
  • Offline Offline
  • Gender: Male
  • Posts: 404
  • My CPG Recources
    • My CPG Recources
Re: Trying to use a php include within my template file.
« Reply #5 on: June 23, 2004, 08:12:34 am »

Gallery: http://www.flat-fish.com/gallery/

template: http://www.flat-fish.com/gallery/themes/default/template.php

As you can see, I added the list at the bottom of the page just as a test. I also altered the init.inc.php file to allow the template page to be a php file.

You can use anycontent.php for that as I'm right.
Logged
DaMysterious.

Burpee

  • Contributor
  • Coppermine regular visitor
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 71
    • Vuurwerklook.com
Re: Trying to use a php include within my template file.
« Reply #6 on: June 23, 2004, 09:34:38 am »

Hmm... I dunno if I get this right... you mean that your bottom half of the template is not being added?
Well, I can't really see everything but in the source for your gallery it says
Code: [Select]
<?php include("nav.php");?>
<!-- end -->
</div>
<!--Coppermine Photo Gallery 1.3.0--></body>
</html>
at the bottom. It's not supposed to say that include, it's supposed to parse it...
I don't know if you've read this post but I think that might do the trick. Coppermine doesn't allow php in your template normally.

Oh and another question, why do you have @import url as styles in your html? Wouldn't it be a better idea to make them all <link rel="stylesheet" href="style.css" />?
Or is this on purpose?

DaMysterious

  • Contributor
  • Coppermine frequent poster
  • ***
  • Country: nl
  • Offline Offline
  • Gender: Male
  • Posts: 404
  • My CPG Recources
    • My CPG Recources
Re: Trying to use a php include within my template file.
« Reply #7 on: June 23, 2004, 11:11:40 am »


Oh and another question, why do you have @import url as styles in your html? Wouldn't it be a better idea to make them all <link rel="stylesheet" href="style.css" />?
Or is this on purpose?


Sorry but I don't understand what you mean. In all Coppermine themes the standard tag <link rel="stylesheet" href="themes/name/style.css" /> is used.
Logged
DaMysterious.

Burpee

  • Contributor
  • Coppermine regular visitor
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 71
    • Vuurwerklook.com
Re: Trying to use a php include within my template file.
« Reply #8 on: June 23, 2004, 05:51:59 pm »

Lol, was referrng to his template

Code: [Select]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html dir="ltr">
<head>
<title>Flat-Fish.com: Gallery - Home</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Pragma" content="no-cache" />

<link rel="stylesheet" href="themes/default/style.css" />
<link href="http://www.cebus-apella.com/lib/non-b.css" rel="stylesheet" />
<style type="text/css" media="screen">
@import url("http://www.cebus-apella.com/lib/default.css");</style>
<style type="text/css" media="all">@import url("http://www.cebus-apella.com/flat-fish/tb-styles.css");</style>
<style type="text/css" media="all">@import url("http://www.cebus-apella.com/lib/b.css");</style>

I do believe only IE and very few other browsers support @import...

dRfruitLOOP

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 34
Re: Trying to use a php include within my template file.
« Reply #9 on: June 24, 2004, 01:55:51 am »

Oh and another question, why do you have @import url as styles in your html? Wouldn't it be a better idea to make them all <link rel="stylesheet" href="style.css" />?
Or is this on purpose?

That design is sort of a combination of a few different pages I was playing with so some bits got mixed in weird like that. I've yet to encounter any issue from having it that way so I haven't changed it. If you think it might be a problem for some people, I will change it. I've new to the whole css thing and so I didn't realize that it could be an issue. About the include, I'll give that other thread a look over and see if that does it for me. Thanks
Logged

dRfruitLOOP

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 34
Re: Trying to use a php include within my template file.
« Reply #10 on: June 24, 2004, 01:59:46 am »

That tip in the other thread did indeed do the trick. Thanks a lot. Very glad to have that working.  ;D
Logged

Burpee

  • Contributor
  • Coppermine regular visitor
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 71
    • Vuurwerklook.com
Re: Trying to use a php include within my template file.
« Reply #11 on: June 24, 2004, 03:26:55 pm »

No problem :D



And as for the @import, I remembered that from something I read in the subSilver CSS from phpbb:

Code: [Select]
/* Import the fancy styles for IE only (NS4.x doesn't use the @import function) */
@import url("formIE.css");

So it should indeed not matter, seeing as nobody uses NS4.x anymore :D (and people that do are probably haunted by incompatibility day and night so they should be used to it by now :D)

dRfruitLOOP

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 34
Re: Trying to use a php include within my template file.
« Reply #12 on: June 24, 2004, 09:57:23 pm »

Thanks again  ;D
Logged

water

  • Coppermine newbie
  • Offline Offline
  • Posts: 7
Re: Trying to use a php include within my template file.
« Reply #13 on: August 01, 2004, 06:21:39 pm »

I don't know if you've read this post but I think that might do the trick. Coppermine doesn't allow php in your template normally.

I've seen lots of references to the post that is refrenced above, but I've never been able to actually access it. does anybody know the correct url to it or any good seach words, I keep coming up blank...

:water
« Last Edit: August 01, 2004, 06:30:17 pm by water »
Logged

Fking

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 37
Re: [Solved]: Trying to use a php include within my template file.
« Reply #14 on: November 20, 2004, 04:06:41 pm »

i also can't access this thread
http://forum.coppermine-gallery.net/index.php?topic=2988.0

obviously there is the solution of the problem which i'm also experiencing.......

help pls
Logged

Burpee

  • Contributor
  • Coppermine regular visitor
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 71
    • Vuurwerklook.com
Re: [Solved]: Trying to use a php include within my template file.
« Reply #15 on: November 20, 2004, 04:42:10 pm »

Hmm... found it again, took me a while to figure out where it was ;)
Open functions.inc.php
Find
Code: [Select]
        $template = fread(fopen($template_file, 'r'), filesize($template_file));Replace with
Code: [Select]
          ob_start();                     // Start output buffering
  include ($template_file);       // Parsed file goes to buffer
  $template = ob_get_contents();  // Assign buffer to $template
  ob_end_clean();                 // Clear buffer and turn off output buffering

Please note that I do not take credit for this code, it was written by someone else quite some time ago...

Fking

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 37
Re: [Solved]: Trying to use a php include within my template file.
« Reply #16 on: November 20, 2004, 06:06:03 pm »

where i have to put the path to the my header file (the file  which i want to be included on top)

Hmm... found it again, took me a while to figure out where it was ;)
Open functions.inc.php
Find
Code: [Select]
       $template = fread(fopen($template_file, 'r'), filesize($template_file));Replace with
Code: [Select]
         ob_start();                     // Start output buffering
  include ($template_file);       // Parsed file goes to buffer
  $template = ob_get_contents();  // Assign buffer to $template
  ob_end_clean();                 // Clear buffer and turn off output buffering

Please note that I do not take credit for this code, it was written by someone else quite some time ago...
Logged

Burpee

  • Contributor
  • Coppermine regular visitor
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 71
    • Vuurwerklook.com
Re: [Solved]: Trying to use a php include within my template file.
« Reply #17 on: November 20, 2004, 06:44:46 pm »

In your template.html, as was described earlier in this topic...

Fking

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 37
Re: [Solved]: Trying to use a php include within my template file.
« Reply #18 on: November 20, 2004, 06:47:54 pm »

works perfect
thanks
Logged
Pages: [1]   Go Up
 

Page created in 0.037 seconds with 20 queries.