Trying to use a php include within my template file. Trying to use a php include within my template file.
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Trying to use a php include within my template file.

Started by dRfruitLOOP, June 22, 2004, 10:43:14 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

dRfruitLOOP

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...
<?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.


Burpee

Quote from: 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...
<?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:
<?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

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.  ???

Joachim Müller


dRfruitLOOP

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.

DaMysterious

Quote from: 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.

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

Burpee

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
<?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

Quote from: Burpee on June 23, 2004, 09:34:38 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.
DaMysterious.

Burpee

Lol, was referrng to his template

<!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

Quote from: Burpee on June 23, 2004, 09:34:38 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

dRfruitLOOP

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

Burpee

No problem :D



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

/* 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)


water

Quote from: Burpee on June 23, 2004, 09:34:38 AM
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

Fking

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

Burpee

Hmm... found it again, took me a while to figure out where it was ;)
Open functions.inc.php
Find
        $template = fread(fopen($template_file, 'r'), filesize($template_file));
Replace with
          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

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

Quote from: 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
       $template = fread(fopen($template_file, 'r'), filesize($template_file));
Replace with
         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...

Burpee

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