View Full Version: php includes screws up colors

Zoids Evolution Forums > Computers and Technology > php includes screws up colors



Title: php includes screws up colors
Description: Yes I do know how to use php includes..


ZeRoRaVeN - November 14, 2005 12:55 AM (GMT)
See this page:
http://www.getanimed.com/navi/right_link.php

Now the page with the includes to that page:
http://www,getanimed.com/testinclude.php

Now why is that? I did a few test using CSS inlines sheet, external sheets, and even the old bgcolors..I don't understand why its coming out with missing colors, the two showing are only images...anyone care to help?

EDIT: bad link...

sammich - November 15, 2005 08:35 PM (GMT)
Without even looking at your CSS, Your test page already has double body and html closing tags.

Is this right? Is this ALL your CSS pages have?

http://www.getanimed.com/css/navi/css/4.css
QUOTE

.rightlinkbackground {
background-color: 9cb6ff;
}
QUOTE

.leftbarnavi {
font-family: Arial, Helvetica, sans-serif;
}


Is there a reason why they're on seperate CSS pages? I don't get this. XD It's so sloppy.

Of course I can't see your PHP includes unless I had the original files... so. Yeah. I can't help you out there. ^^;

ZeRoRaVeN - November 15, 2005 09:54 PM (GMT)
Oh that's just commented out, because I was doing something else mid design, and then I changed it to that, and so I decided to comment out the CSS so it won't apply..though I guess I should try it without the comment out...

I'm sure that's all there is...ah I didn't notice that...

Capitila - November 16, 2005 03:22 AM (GMT)
Ew, tables.
I'd suggest you look further into CSS and coding without tables, personal preference really, and it's not as sloppy and much easier to work with SSI.

ZeRoRaVeN - November 20, 2005 03:12 AM (GMT)
I do code with CSS, but I do like tables, it makes neat content. I've heard of SSI but I don't know much about it...

Tilly - November 20, 2005 08:13 AM (GMT)
My Zoids site's includes:
http://www.creativeinsanity.net/zoids/top.txt
http://www.creativeinsanity.net/zoids/bottom.txt

And yes, I KNOW my CSS has errors, they're from the fix for the menu in IE.

And a page, pre all that:

CODE
<!--#include file="top.txt" -->
<h1>Models</h1>
This is the brain-eaty stuff, folks.
<p>
<hr>
<p>
<a href="info.shtml">General info</a> - Needs a bit of a rework.
<p>
<a href="reviews/">Reviews</a> - I ramble about Zoids.  A lot.  Includes photos of many of the reviewed critters.
<p>
<a href="reviews/collection.shtml">My collection</a> - Photos of Zoids on shelves.  Always very outdated.
<p>
<a href="zoidswantlist.shtml">Want List</a> - Who doesn't have one of these?
<!--#include file="bottom.txt" -->


The end result looks like this, without me having to do anything else:
http://www.creativeinsanity.net/zoids/models.shtml

ZeRoRaVeN - November 21, 2005 01:52 AM (GMT)
um..but doesn't that need .shtml pages? I like .php pages, I'm planning to add some php functionality to my site so .shtml won't do.... :-/ well thanks anyway...

HaTcH - November 21, 2005 02:22 AM (GMT)
Seems to me like you are using include incorrectly in your php files. We chatter earlier today, I don't get why you didn't listen to my suggestion.

SSI requires a server that supports the function. (Hecnce, Server Side Includes)

(The reason that its in a comment block <!-- --> is because if the server didn't know how to handle an #include directive, it would have just simply printed the text, #incude filename.ext . Thats the purpose of the comment brackets.

The method I use to imitate SSI using PHP is thus:

CODE

<html><head><title>Foobar</title>

<?php
echo get_include_contents('css.php');

function get_include_contents($filename) {
  if (is_file($filename)) {
      ob_start();
      include $filename;
      $contents = ob_get_contents();
      ob_end_clean();
      return $contents;
  }
  return false;
}
?>

</head>
moving on...


This simply outputs this:
CODE

<html><head><title>Foobar</title>
[contents of css.php, which is just a line like <link rel="stylesheet" type="text/css" href="text.css">]

</head>
moving on...


It can be also used like this to include perhaps a top and bottom of a page:
CODE

<?php
echo get_include_contents('top.txt');

function get_include_contents($filename) {
  if (is_file($filename)) {
      ob_start();
      include $filename;
      $contents = ob_get_contents();
      ob_end_clean();
      return $contents;
  }
  return false;
}
?>

Welcome to my website blah blah blah

<?
echo get_include_contents('bottom.txt');
?>


Which outputs:
CODE

[contents of top, stuff like a common header and html and body tags]

Welcome to my website blah blah blah

[contents of bottom, closing tags for the body and html and whatever else is common]

ZeRoRaVeN - November 21, 2005 02:46 AM (GMT)
It's not that I didn't listen, its that it didn't seem to work either....ok I'll check out what you mentioned below and I'll post my results later...




Hosted for free by InvisionFree