Jump to content

twittoris

Members
  • Posts

    87
  • Joined

  • Last visited

    Never

Everything posted by twittoris

  1. woah that gives a crazy output with two separate tables and none of my txt file.
  2. Oh yeah I initially had it set to arrange in alphabetical order. that code gave me an error, $http = (substr($website, 0,7)=="http://") ? '' : 'http://' ; $website = "<a href="{$http}{$website}">{$website}</a><br/> "; the $website= gives an error of Parse error: syntax error, unexpected '{' in /home/content/e/m/p/empireestate/html/list/listcreator.php on line 115 and im not good that yet
  3. I am currently creating a table like so: while (!feof($fp)) { $line = fgets($fp,1024); //use 2048 if very long lines $row++; list ($website, $description)= split ("\|", $line); //$website= "<a href=\"" . $website . "\">" . $website . "</a><br/>"; $Http = substr($website, 0,7); if ($Http=="http://") { $website= "<a href=\"".$website. "\">" . $website . "</a><br/>"; } else { $website="<a href=\"http://".$website. "\">" . $website . "</a><br/>"; } $col[$row] = array($row, $website, $description, $adsense); } fclose($fp); sort($col); reset ($col); $arrays = count($col) - 1; $loop = -1; while ($loop < $arrays) { $loop++; echo ' <tr> <td>'.$col[$loop][1].'</td> <td>'.$col[$loop][2].'</td> <td>'.$col[$loop][3].'</td> </tr>'; } echo ' </table> <p><small>1 December 2004 · Last updated: '.date('j F Y', getlastmod()); $HtmlCode= ob_get_contents(); ob_end_flush(); $fh=fopen('cookies.html','w'); fwrite($fh,$HtmlCode); fclose($fh); ?> I want to take the table that is created in cookies.html and create cookies1.html, cookies2.html with every 3 rows created. EDIT: CODE TAGS
  4. I actually just did this. Put this on top for where you want to start capturing output: ob_start(); put this on the bottom of the php $HtmlCode= ob_get_contents(); ob_end_flush(); $fh=fopen('NewPage.html','w'); fwrite($fh,$HtmlCode); fclose($fh);
  5. Is it possible to have the script (PHP/Javascript) only display a certain amount of results (like top 3) that are in a table and take the next three and save it as a new table in a new file?
  6. had to change it to the variable instead of echo but now it works perfectly.
  7. yeah i see where you are going. I am new to php and am not sure how to apply it to my code above...
  8. my last post wasnt entirely accurate, it works if http:// was entered in the text file. is there a check we could apply that would add an http or take an extra http away?
  9. close.... while (!feof($fp)) { $line = fgets($fp,1024); //use 2048 if very long lines $row++; list ($website, $description)= split ("\|", $line); $website= "<a href=\"" . $website . "\">" . $website . "</a><br/>"; $col[$row] = array($row, $website, $description, $adsense); the webpage column is now a clickable hyperlink. However, the url is http://mysite.com/www.$website.com i.e. www.mysite.com/www.yahoo.com which does not go to the right webpage
  10. I have a script which reads a .txt file formatted URL|Description it then loops the entries into a table. However, the URL is not a clickable link. How do I include an ahref in the loop? while (!feof($fp)) { $line = fgets($fp,1024); //use 2048 if very long lines $row++; list ($website, $description)= split ("\|", $line); $col[$row] = array($row, $website, $description, $adsense); Help??
  11. Ok I have hit a wall. Im trying to create a simple page that allows me to enter 3 types of data website, description, adsensecode(javascript) Currently the webpage takes the input from the forms and saves it in a text file (url.txt) like this: www.reonomy.com|Real Estate| www.reonomy.com|Real Estate| Which is created by my php script here: <?PHP $filename = 'url.txt'; $fp = fopen($filename, "a"); //print $a $write = fputs($fp, $_POST["website"]); $write = fputs($fp, "|"); $write = fputs($fp, $_POST["description"]); $write = fputs($fp, "|\n"); fclose($fp); header('Location: http://URL/listcreator.php'); ?> I then have listcreator.php do this: <?php ob_start(); $sortby = $_SERVER['QUERY_STRING']; $set = ''; if ($sortby == '') { $header = 'First Name'; $sortby = 'firstname'; $set = 'y'; } if ($sortby == 'surname') { $header = 'Surname'; $set = 'y'; } if ($sortby == 'city') { $header = 'City'; $set = 'y'; } if ($sortby == 'points') { $header = 'Points'; $set = 'y'; } if ($sortby == 'car') { $header = 'Car'; $set = 'y'; } if ($sortby == 'colour') { $header = 'Colour'; $set = 'y'; } if ($sortby == 'age') { $header = 'Age'; $set = 'y'; } if ($set == '') { echo 'The variable at the end of the web address did not match one required by the code. Please check the web address for errors.'; exit; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> <title>Adsense Free Web Directory</title> <style type="text/css"> <!-- body, th, td, p, small { font-family:'Times New Roman',Times,serif; font-size:100%; color:#444; } small {font-size:90%;} table { border:1px solid #ccf; padding:3px; } td, th { background-color:#def; padding:7px 20px 7px 20px; } th {background-color:#dee; color:#677;} h1 {font-size:120%; color:#558;} h1 .sortby {color:#855;} --> </style> </head> <body> <?php echo '<h1>Flat File Database Sorted By <span class="sortby">'.$header.'</span></h1> <p>To sort the columns click on the headers.</p> <table summary="List of demo fields"> <tr> <th><a href="?">Website</a></th> <th><a href="?surname">Description</a></th> <th><a href="?city">Ad</a></th> </tr>'; $fp = fopen('cookies.txt','r'); if (!$fp) {echo 'ERROR: Unable to open file.</table></body></html>'; exit;} while (!feof($fp)) { $line = fgets($fp,2048); //use 2048 if very long lines $row++; list ($website, $description, $adsense)= split ('\|', $line); //$points, $car, $colour, $age) if ($sortby == 'website') $sortkey = strtolower($website); if ($sortby == 'description') $sortkey = strtolower($description); if ($sortby == 'adsense') $sortkey = strtolower($adsense); //if ($sortby == 'points') $sortkey = $points; //if ($sortby == 'car') $sortkey = strtolower($car); //if ($sortby == 'colour') $sortkey = strtolower($colour); //if ($sortby == 'age') $sortkey = $age; $col[$row] = array($sortkey, $website, $description, $adsense); //, $points, $car, $colour, $age); } fclose($fp); sort($col); reset ($col); $arrays = count($col) - 1; $loop = -1; while ($loop < $arrays) { $loop++; echo ' <tr> <td>'.$col[$loop][1].'</td> <td>'.$col[$loop][2].'</td> <td>'.$col[$loop][3].'</td> </tr>'; } echo ' </table> <p><small>1 December 2004 · Last updated: '.date('j F Y', getlastmod()); $HtmlCode= ob_get_contents(); ob_end_flush(); $fh=fopen('cookies.html','w'); fwrite($fh,$HtmlCode); fclose($fh); ?> </body> </html> I am having trouble with two things: 1. Making the table that is created display the urls as links 2. I want to make a variable equal a google adsense ad and place it in the 3rd colum of my table Can someone give me some direction? Thanks
×
×
  • 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.