lurah Posted September 13, 2006 Share Posted September 13, 2006 Hi all. This is my first "real" php script and it surely looks like it ::) It works ok except with windows IE browser as far as i have received information from members of site.Im not sure is it up to my code or how IE works. Some advices would be nice ::)FILE: links.php[code]/* links.php main file on our Related Links page. virtanen.kristian@ascii-world.com PUBLIC DOMAIN 2006 */?><html> <head> <title>ASCII-World - Related Links</title> <style > a { margin-top: 0px; margin-bottom: 10px; font-family: Arial, Verdana; font-size: small; font-weight: bolder } a:link { margin-top: 0px; margin-bottom: 0px; margin-left: 0px; color: #FFFFDD; text-decoration: none } a:visited { margin-top: 0px; margin-bottom: 0px; margin-left: 0px; color: #FFFFDD; text-decoration: none } a:active { margin-top: 0px; margin-bottom: 0px; margin-left: 0px; color: #FFFFDD; text-decoration: underline } a:hover { margin-top: 0px; margin-bottom: 0px; margin-left: 0px; color: #FFFFFF; text-decoration: underline } </style> </head> <body bgcolor="#606060"> <center> <table cellpadding="0" cellspacing="0" border="0" width="100%"> <tbody> <tr> <td align="left" bgcolor="#606060" width="100%" colspan="2" class="header"><font face="Arial" size="2" color="#FFFFFF"><b>INTRODUCTION:</b><br><br></font> </td> </tr> <tr> <td width="50%" colspan="2" bgcolor="#606060" > <p align="justify"> <font face="Arial" size="2" color="#FFFFBB"> <b>The ASCII-World related links is where you can find other websites that have relevant information or projects.<br> They could be other websites boosting the ASCII effort, ASCII projects in the making,<br> Text Games of all kinds, you name it we'll do our best to have it here available for you.</b> </p> </td> </tr> </tbody> </table> </center> <table align="center" cellpadding="0" cellspacing="0" border="0" width="80%"> <tr> <td align="left" bgcolor="#606060" width="50%" colspan="2" class="header"> <form action="links.php" method="post"> <select name="category"> <option value="">Select category</option> <?php include"select_catagories.php"; ?> </select> <input type="submit" value="Show links"> </form> </td> </tr> </table> <?php// selected category $cat_file = $_POST['category'];// let's open selected link list file$handle = @fopen("links_db/".$cat_file, "r");// file handling/readingif ($handle) { while (!feof($handle)) // file reading loop start { $address = fgets($handle, 4096); // first line is URL $site = fgets($handle, 4096); // secons line is name of site $desc = fgets($handle, 4096); // third is description if ($address != "") // if there is anything to output { echo "<li><b>"; // font, size and colors. <li> too echo "<a href=\"".$address."\" target=\"Blank\" >".$site."</a></b><br>"; // we spit our link out on screen echo "<font face=\"Arial\" size=\"2\" color=\"#FFFFBB\">".$desc."</li><br><br></font>"; // let's not forget description } // end of (if $address) checking } // file reading loop end fclose($handle); // close file}?> </body></html>[/code]FILE: select_categories.php[code]<?php/* select_catagories.php this file reads current catagories from file links_db/catagories.txt and adds em on select area. virtanen.kristian@ascii-world.com PUBLIC DOMAIN 2006 */// we open our category "database"$handle = @fopen("links_db/categories.txt", "r");if ($handle) { while (!feof($handle)) { $cat_name = fgets($handle, 4096); // name of category IE:(ASCII Art Websites) $cat_file = fgets($handle, 4096); // name of it's link's list. ASCII Art Websites = 1.txt // and let's spit it on our select box echo "<option value=\"".$cat_file."\">".$cat_name."</option>"; }}?>[/code]Example of categories.txt[code]ASCII Art Websites1.txtASCII tools and generators2.txtGeneral ASCII Websites3.txt [/code]and link txt files (1.txt)[code]http://homepage.ntlworld.com/palmer666/David Palmer's siteASCII Art and comics by David Palmer.http://www.heartnsoul.com/ascii_art/ascii_objects.htmASCII Art Gallery - objectsSo much pictures, you gona need a day to see em all. [/code]You can find this from www.ascii-world.com -> Related LinksAnd whole "package" can be downloaded from http://www.adaworld.com/asciiworld/links/links.tar.gz Quote Link to comment Share on other sites More sharing options...
btherl Posted September 13, 2006 Share Posted September 13, 2006 Have you validated your HTML? Very often errors are handled differently by different browsers, leading to different behaviour. Even with valid HTML, you can get different behaviour.ACtually I see some invalid HTML already. A table is structured into rows, like this:[code]<table> <tr> <td> </td> <td> </td> </tr> </table>[/code]A td can only exist inside a tr. Both browsers should be able to handle that fine though, so i doubt it's the problem. Quote Link to comment Share on other sites More sharing options...
lurah Posted September 13, 2006 Author Share Posted September 13, 2006 Thanks for tips btherl.I fixed <td><tr> issue. Alltho it didnt help as you assumed. Got to keep on wondering. Quote Link to comment Share on other sites More sharing options...
jrodd32 Posted September 13, 2006 Share Posted September 13, 2006 you might want to try saving the select_catagories.php file as an .inc file and changing your include statements as necessary Quote Link to comment Share on other sites More sharing options...
lurah Posted September 13, 2006 Author Share Posted September 13, 2006 Hi.I doubt it's up to select_catagories.php. I have to specify this. IE users can see and use select box, but they cant see link list created after button press.So i doubt, problem is on this one [code] echo "<font face=\"Arial\" size=\"2\" color=\"#FFFFBB\"><li>"; // font, size and colors. <li> too echo "<b><a href=\"".$address."\" target=\"Blank\" >".$site."</a></b><br></li>"; // we spit our link out on screen echo $desc."<br><br></font>"; // let's not forget description } // end of (if $address) checking[/code] Quote Link to comment Share on other sites More sharing options...
mainewoods Posted September 13, 2006 Share Posted September 13, 2006 You should not be ending your head section before starting your styles code[code]<head><title>ASCII-World - Related Links</title></head> <style >[/code]place the [code]</head>[/code]just before the [code]<body>[/code] Quote Link to comment Share on other sites More sharing options...
lurah Posted September 13, 2006 Author Share Posted September 13, 2006 Thanks mainewoods for tip.I fixed more html part of source. I pasted it on first post of thread.Still IE dont echo nothing. Im totally out of ideas how to solve this one. Quote Link to comment Share on other sites More sharing options...
roopurt18 Posted September 13, 2006 Share Posted September 13, 2006 Is your PHP configured to display errors? If it's not and you have a script error somewhere chances are no output may even be making it to the browser.When you view the page in the browser, look at the HTML source the browser received and see where it ended. That may help. Quote Link to comment Share on other sites More sharing options...
lurah Posted September 13, 2006 Author Share Posted September 13, 2006 Ok, after testing result is this. Script works fine with older IE versions. IE 7 wont work.So i guess it's IE issue then. Well, never liked MS anyway lol. But would be nice to get it working with IE. Quote Link to comment Share on other sites More sharing options...
lurah Posted September 13, 2006 Author Share Posted September 13, 2006 Ok, this one is solved. [code] $cat_name = fgets($handle, 4096); // name of category IE:(ASCII Art Websites) $cat_name = str_replace(array("\r", "\n"), "", $cat_name); // EOL marks out of there $cat_file = fgets($handle, 4096); // name of it's link's list. ASCII Art Websites = 1.txt $cat_file = str_replace(array("\r", "\n"), "", $cat_file); // EOL marks out of there[/code]End of line marks readed from .txt files were the messy ones. Thanks all for helping me. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.