moOt Posted August 8, 2006 Share Posted August 8, 2006 Hey All,I am kind of new to PHP and I dont even know where to begin for a script that I need to make. I checked the posting guidelines and I made sure to check for tutorials or premade scripts but there are so many different script sections I dont know where to even begin, its overwhelming!Well anyway, Im looking to create my own script very similar to the headlines script seen in many of the News Publishing PHP scripts. I basically want to put links to a bunch of word, picture and powerpoint files in the top of a text file. After I have updated the links in the text file I would like to display the first ten links within that file on to a webpage. If my intentions are unclear its similar to the Headlines script (it displays the last 5 news topics). So basically I would put a PHP script on my page that would call a file to display these links!. I have no clue where to begin any tutorials/help would be much appreciated! Thanks for your time!- Matt Quote Link to comment Share on other sites More sharing options...
corbin Posted August 8, 2006 Share Posted August 8, 2006 I suggest using a database but[code=php:0]<?$farray = file("links.txt");$c = count($farray);if($c > 5) { $s = $c - 5; } else { $s = 0; } //foreach($farray as $key => $value) {//echo $value;//} $i = 0;while($i <= 5) {echo $farray[$s];$i++;$s++;}?>[/code]will display the last 5 lines in links.txtIf you use this youll have to put the links in the form of [code]<a href="http://site.com/page.ext">Text to display</a>[/code] Quote Link to comment Share on other sites More sharing options...
moOt Posted August 8, 2006 Author Share Posted August 8, 2006 Awesome thank you very much for pointing me in the right direction! Ill let you know how it goes! Appreciate it !! =)-Matt Quote Link to comment Share on other sites More sharing options...
corbin Posted August 8, 2006 Share Posted August 8, 2006 http://www.w3schools.com/php/php_file.asp is a short tutorial that might help you... Quote Link to comment Share on other sites More sharing options...
moOt Posted August 11, 2006 Author Share Posted August 11, 2006 Can anyone help me? when i insert this code , everything in red is displayed as regular text on my page.. Why ? <?php$farray = file("links.txt");$c = count($farray);if($c > [color=red]5) { $s = $c - 5; } else { $s = 0; } //foreach($farray as $key => $value) {//echo $value;//} $i = 0;while($i <= 5) {echo $farray[$s];$i++;$s++;}?>[/color] 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.