redarrow Posted May 17, 2009 Share Posted May 17, 2009 advance thank you. i am currently creating a add url/directory web site, the links need be are 6000 links,i have created the links with in a array, and then name it via a function name, so i can understand what what. have you got any suggestions please. example of the arts link. <?php // get the link names within a array. $links=array( "ARTS"=> "Animation, Antiques@, Architecture, Art History, Bodyart, Classical Studies, Comics, Costumes, Crafts, Dance@, Design, Digital, Entertainment, Graphic Design, Humanities, Illustration, Literature, Movies, Music, Myths and Folktales@, Native and Tribal@, Online Writing, Performing Arts, Photography, Radio, Rhetoric@ , Television, Theatre@, Typography@, Video, Visual Arts, Writers Resources, Archives@, Awards, Book Shopping@, Chats and Forums, Contests, Cultures and Groups, Directories, Education, Events, Genres, Libraries@, Magazines and E-zines, Museums@, News and Media, Organizations, People, Periods and Movements, Publishers@, Regional, Web Rings, Weblogs, Business: Arts and Entertainment, Kids and Teens: Arts "); // create a function to get the links array. function arts_link($links){ $res=explode(',',$links['ARTS']); foreach($res as $key=>$val){ echo " <a href='$val' title'what ever'>$val</a><br>";}} //echo the links via the function. echo arts_link($links); ?> Link to comment https://forums.phpfreaks.com/topic/158474-link-advice-via-php/ Share on other sites More sharing options...
waynew Posted May 17, 2009 Share Posted May 17, 2009 Why not use a database table setup like so? Category category_id category_title Sub_category sub_category_id sub_category_title category_id Link link_id url link_title sub_category_id Link to comment https://forums.phpfreaks.com/topic/158474-link-advice-via-php/#findComment-835776 Share on other sites More sharing options...
Axeia Posted May 17, 2009 Share Posted May 17, 2009 At least nest the array directly instead of creating unnecessary overhead by doing an explode, but ye using a database sounds like a much better idea. Link to comment https://forums.phpfreaks.com/topic/158474-link-advice-via-php/#findComment-835806 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.