Jump to content

PHP breaks CSS menu


PHP_kid

Recommended Posts

Yes, I am just saying it's bad practice, even though it is something generally used. If the file is 100% pure HTML, the why not use SSI. Include will work, but opens a whole can of potential problems (such as if your html gets 'infected' through an exploit of just this method).  Code like ">>" also are interpreted, the list goes on.  file_get_contents() / echo combination doesn't allow for interpretation of inserted code.

 

As for PHP_kid's problem in OP, I believe that it does lie within the IE6 style statements as Pikachu2000 pointed out.

 

I am confident you will notice the problem and help the OP resolve this issue though.  Was simply pointing out bad practice as "include" does open a whole can of worms best left closed to internal code execution only.

 

Ok. I have taken the OP's code and put it on my server. It seems to work fine in the three browsers I tested: IE8, FF 3.6.6 and Chrome 5.0.375.86. The URL on my server to test it is: http://www.rbnsn.com/phpfreaks/php_kid/

 

Ken

Link to comment
Share on other sites

For odd characters, you could try switching your header to something like the following

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Your Site Name</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

 

This also helps with some compatability issues with CSS (W3 Transitional), and the meta http-equiv, tells the browser to display UTF-8 chars properly.

Link to comment
Share on other sites

As for the char at the very beginning, not sure why that is happening outside of the editor, or something funky the "include" command is doing to it. To be safe that it isn't the "html" file you are including, try removing that char using the following free editor:

 

Notepad++

 

If the character is not in the "html" file when opening with that program, then there is something happening during the "include" process which is adding it.  Good luck you guys :)

 

thnx Ken.

 

 

that works in all of my browsers......... so that leads me to believe the PHP running at NetSol is whacked.... 

 

it is confirmed, the issue seems to be the 1st byte of my src after calling index.php, the 1st byte is a special char (unix line break, the small box symbol), see attached pic. when i copy out the src it was removing this char, hence why it then worked.

 

so why do i get a special char as 1st byte??  i'm gonna try a different text editor....

Link to comment
Share on other sites

my F'in editor !!!!! M'fer M'fer.

 

thnx all for your help. i use UltraEdit, was saving docs as utf-8 with default line terminator with BOM. i copied everything into notepad and saved as ansi and it now works fine. it was the index.php that was causing the problem. i will try Uedit with utf-8 no BOM.

Link to comment
Share on other sites

I use UltraEdit also. I turned off the BOM.

 

Ken

yes, that also works.

man, what a frustrating issue.

 

when i do a view src from IE it will open in Uedit, then all i did was do a file save as, but i didnt notice it was saving that file as ansi/ascii.

 

it all makes sense now.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.