Welcome to WebmasterWorld Guest from 54.145.39.186

Forum Moderators: not2easy

Message Too Old, No Replies

php includes and css

using includes to assemble page = minor hiccups in layout

     

mightymid

9:03 pm on Oct 30, 2008 (gmt 0)

10+ Year Member



I'm not sure whether this goes here or in the PHP forum, but here's what's up...

I created an html doc that links to an external stylesheet. After I got the layout just right, I moved portions of my html doc into php include files. (The header info is in one include file; the navigation is in another; etc.) I then created a new index file to assemble all of my includes.

When the new index file runs, it assembles just fine. But there are minor layout changes --- a margin or padding as been inserted at the top of the document, and a div that should be centered is not.

The source code of the assembled document is identical to the source code of my original html doc. So what kinds of things could account for these little layout changes?

I didn't want to inundate this thread with code just yet, figuring that there may be a broad answer to this question. I'm happy to post code if needed though.

lavazza

10:59 pm on Oct 30, 2008 (gmt 0)

5+ Year Member



If your CSS incorporates images (esp for borders or similar) there might be issues with the 'relative paths' (the ../ bits)
e.g.

.myClass {
background:#fff url(../myFolder/myFile.gif) top repeat-x;
}
or
.myClass {
background:#fff url(../../myFolder/myFile.gif) top repeat-x;
}

swa66

11:56 pm on Oct 30, 2008 (gmt 0)

WebmasterWorld Senior Member swa66 is a WebmasterWorld Top Contributor of All Time 10+ Year Member



I'd triple check if the code delivered to the browser is 100% identical. I've a funny feeling there will be a difference somewhere.

mightymid

7:12 pm on Oct 31, 2008 (gmt 0)

10+ Year Member



I don't have images yet, lavazza, but that's a good thing to keep in mind for when I start adding them. Thank you.

I triple-checked the code, swa66, and did find an empty square in the source of the assembled php page. Tis a character encoding thing, I presume. I can take it from here. Many thanks.

WannaKnowSEO

7:21 pm on Oct 31, 2008 (gmt 0)

5+ Year Member



What you're talking about are probably browser differences of interpretation. Have you tried looking at it in both IE and FFX to see if this is the case?

mightymid

1:23 am on Nov 1, 2008 (gmt 0)

10+ Year Member



Oh geeze, I thought I had it fixed, but no...

As a simple html doc linked to a css file, the layout is perfect in both FF2 and IE7. When I convert the html file to a php file, and import the html with includes, the layout is still perfect in FF2, but it changes in IE7.

I double, triple and quadruple-checked the source codes from the original html doc, the php file as rendered in FF, and the php file as rendered in IE --- and they are all ABSOLUTELY identical. And they are all linked to the same css file.

Would the problem have anything to do with my hosting company's php install? Should I move this question over to the php forum?

mightymid

1:52 am on Nov 1, 2008 (gmt 0)

10+ Year Member



Found the solution:

Re-saved all files (including my php includes and .css) in Notepad, being sure to select "ANSI" for encoding. The encoding had previously been UTF-8.

Problem solved.

 

Featured Threads

Hot Threads This Week

Hot Threads This Month