TheLoveableMonty Posted February 4, 2009 Share Posted February 4, 2009 This is what I'm trying to do. I'm trying to create a directory archiving news regarding a specific subject from different countries, arranged in alphabetical order by the name of the country. It will involve opening a data file arranged as follows: Source Name:~:http://www.sourcewebsite.com:~:Country Essentially, it will store all three as variables in an array, check the third variable in the array (Country) to see if it matches with what's stored in a variable in an "if" loop, then print it. Here's the problem though. I could, and probably will have to store each country name in a separate file, exploding the file to store it as an array then going through the array and printing every item as part of the loop in alphabetical order. I wanted to know if there was any other way to do what I'm trying to achieve, as this seems like if the content increased significantly in volume it would take a while to carry out. Anybody get me? I've brainstormed everything and this is the last real headache. Link to comment https://forums.phpfreaks.com/topic/143816-big-problem/ Share on other sites More sharing options...
TheLoveableMonty Posted February 4, 2009 Author Share Posted February 4, 2009 while($i<=$arrayEnd) { $entry =explode($separator,$filterEntries[$i]); $title =$entry[0]; $link=$entry[1]; $country=$entry[2]; echo "<TR><TD BGCOLOR=\"#2A338D\" VALIGN=\"top\"><FONT FACE=\"trebuchet ms\" COLOR=\"#F3B809\" SIZE=\"3\"><B>$title</FONT></B><BR>"; echo "<A LINK=".$link.">$link</A> - $category"; } echo "</FONT></TD></TR>"; $i++; } This is the snippet of code I'm using to display articles bit by bit. I need to do what I just said with this snippet, but I can't figure the damn thing out. If I use an "if" within this loop, it simply filters the results and only displays posts under the one country mentioned. I'm staring at the code and can't figure the damn thing out. Link to comment https://forums.phpfreaks.com/topic/143816-big-problem/#findComment-754637 Share on other sites More sharing options...
trq Posted February 4, 2009 Share Posted February 4, 2009 Is there a particular reason your not using a database for this? It would make things alot simpler and much more efficient. Link to comment https://forums.phpfreaks.com/topic/143816-big-problem/#findComment-754683 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.