deathgame3 Posted March 19, 2009 Share Posted March 19, 2009 hi so simple i have a plain list of link which is really long, there are about 400 links, this is the php code used to display them: <a href="<?php echo $category->link; ?>" class="category"><?php echo $category->title;?></a> they are gained thru mysql, now since the list is really long, i want to create a jump list for it(to jump to all links starting wid A,B,C,D..etc) similar to here: now to do tht i know first i wud have to do this: <a href="#a">A</a> then i wud have to place <a name="a"> before the first link starting wid A...and similar for the rest of the characters....but the problem is tht the list is displayed using php wid only this code: <a href="<?php echo $category->link; ?>" class="category"><?php echo $category->title;?></a> so i dont know where i shud put <a name="a"> etc....cuz i dont see the list tht means i cannot edit it :\ so please all help is appreciated! Link to comment https://forums.phpfreaks.com/topic/150238-php-mysql-jump-to-list/ Share on other sites More sharing options...
jceresini Posted March 27, 2009 Share Posted March 27, 2009 You can put the name tag at just before the href portion such as: <a name="a" href="<?php echo $category->link; ?>" class="category"><?php echo $category->title;?></a> You'll need to use some login to determine which letter to use for the name tag, and to determine if its the first tag that begins with that letter, because you won't want a number of anchor's with the same name Joe Ceresini Network Engineer [email protected] HostMySite.com Link to comment https://forums.phpfreaks.com/topic/150238-php-mysql-jump-to-list/#findComment-795562 Share on other sites More sharing options...
thepip3r Posted March 27, 2009 Share Posted March 27, 2009 you could easily use if/elseif or switch logic to grab the first letter of the $category->title parameter to see where it would fall alphabetically and then have it write out the name="[a][c][e]..." etc where it's appropriate. Link to comment https://forums.phpfreaks.com/topic/150238-php-mysql-jump-to-list/#findComment-795566 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.