lurah
New Members-
Posts
9 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Not Telling
lurah's Achievements
Newbie (1/5)
0
Reputation
-
Hi all. I have tried to search answer but havent got this solved. write.php receives $_POST values from another file. Values are passed as should. I tested many times with echo $value. [code]if (($cat != "new") && ($newcat != "")) { echo "Select \"New category\" to create it.<br>"; $false++; } [/code] [code]if ($cat_new != "") { if ($cat != "new") { echo "Select \"New category\" to create it.<br>"; $false++; } } [/code] Both ways, i allways end up on $false++ even the values are right. So the idea is, that if $cat_new != "", then $cat must be "new" or $false increases.
-
Well, some solution. Not beautifull but it works ;D [code]function list_catagories() { $folder = opendir("links_db/"); // täältä luetaan tiedostot $file = readdir($folder); while ($file) { if ($file != "." && $file != "..") { // jos ei ole hak. niin sitten se on .txt kun muita filuja siellä ei ole. $temp = file("links_db/".$file); $cat_name = $temp[0]; $cat_name = str_replace(array("\r", "\n"), "", $cat_name); // draizin kiva rivinvaihto poistaja echo "<option value=\"".$file."\">".$cat_name."</option>"; // tungetaan tiedoston nimi ja ensimmäinen rivi valinta laatikkoon } $file = readdir($folder); } closedir($folder); [/code]
-
I try to readdir(links_db/) and fgets(links_db/filename) first line of file. Idea is to create selection box, where $file is value and first line of file is what is output on selection box. [code]<?php function list_catagories() { $folder = opendir("links_db/"); // from this directory we want files listed $file = readdir($folder); while ($file) { if ($file != "." && $file != "..") { // if it's not dir it's .txt (no else files on that directory) $handlefile = @fopen($file, "r"); // we open it $cat_name = fgets($handlefile, 4096); // first line is name of category $cat_name = str_replace(array("\r", "\n"), "", $cat_name); // EOL marks out of there echo "<option value=\"".$file."\">".$cat_name."</option>"; // and let's spit it on <option></option> fclose($file); // this file is done } $file = readdir($folder); } closedir($folder); } ?> <form action="links.php" method="post"> <p> <select name="category"> <option value="">Links Main menu</option> <?php list_catagories(); ?> </select> <input type="submit" value="Ok"> </p> </form> [/code] First listed file wont open and it's $cat_name dont show up on select box. Only empty line. When i choose one of those values from <form> nothing happens. Here is links.php what uses code above. [code]<html> <head> <title>ASCII-World - Related Links</title> </head> <?php include"../css/style.html"; ?> <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>text blaablaa</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"> <?php include"select_catagories.php"; ?> </td> </tr> </table> <HR> <?php // selected category $cat_file = $_POST['category']; $handle = @fopen("links_db/".$cat_file, "r"); // let's open selected link list file if ($handle) // file handling/reading { 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 } ?> [/code] All help is welcomed. Im pretty lost with this one now.
-
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.
-
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.
-
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.
-
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]
-
Thanks for tips btherl. I fixed <td><tr> issue. Alltho it didnt help as you assumed. Got to keep on wondering.
-
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/reading if ($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 Websites 1.txt ASCII tools and generators 2.txt General ASCII Websites 3.txt [/code] and link txt files (1.txt) [code]http://homepage.ntlworld.com/palmer666/ David Palmer's site ASCII Art and comics by David Palmer. http://www.heartnsoul.com/ascii_art/ascii_objects.htm ASCII Art Gallery - objects So much pictures, you gona need a day to see em all. [/code] You can find this from www.ascii-world.com -> Related Links And whole "package" can be downloaded from http://www.adaworld.com/asciiworld/links/links.tar.gz