forum.coppermine-gallery.net

Support => cpg1.3.x Support => Older/other versions => cpg1.3 Themes/Skins/Templates => Topic started by: dRfruitLOOP on June 22, 2004, 10:43:14 pm

Title: Trying to use a php include within my template file.
Post by: dRfruitLOOP 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.

Title: Re: Trying to use a php include within my template file.
Post by: Burpee 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.
Title: Re: Trying to use a php include within my template file.
Post by: dRfruitLOOP 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.  ???
Title: Re: Trying to use a php include within my template file.
Post by: Joachim Müller on June 23, 2004, 05:43:34 am
link?

GauGau
Title: Re: Trying to use a php include within my template file.
Post by: dRfruitLOOP 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.
Title: Re: Trying to use a php include within my template file.
Post by: DaMysterious 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.
Title: Re: Trying to use a php include within my template file.
Post by: Burpee 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 (http://forum.coppermine-gallery.net/index.php?topic=2988.0) 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?
Title: Re: Trying to use a php include within my template file.
Post by: DaMysterious 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.
Title: Re: Trying to use a php include within my template file.
Post by: Burpee 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...
Title: Re: Trying to use a php include within my template file.
Post by: dRfruitLOOP 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
Title: Re: Trying to use a php include within my template file.
Post by: dRfruitLOOP 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
Title: Re: Trying to use a php include within my template file.
Post by: Burpee 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)
Title: Re: Trying to use a php include within my template file.
Post by: dRfruitLOOP on June 24, 2004, 09:57:23 pm
Thanks again  ;D
Title: Re: Trying to use a php include within my template file.
Post by: water on August 01, 2004, 06:21:39 pm
I don't know if you've read this post (http://forum.coppermine-gallery.net/index.php?topic=2988.0) 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
Title: Re: [Solved]: Trying to use a php include within my template file.
Post by: Fking 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
Title: Re: [Solved]: Trying to use a php include within my template file.
Post by: Burpee 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...
Title: Re: [Solved]: Trying to use a php include within my template file.
Post by: Fking 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...
Title: Re: [Solved]: Trying to use a php include within my template file.
Post by: Burpee on November 20, 2004, 06:44:46 pm
In your template.html, as was described earlier in this topic...
Title: Re: [Solved]: Trying to use a php include within my template file.
Post by: Fking on November 20, 2004, 06:47:54 pm
works perfect
thanks