dheaven69 Posted April 16, 2007 Share Posted April 16, 2007 function setPointer(&$array, $set_key) { reset($array); while ($set_key != key($array)) { next($array); } } the function i use for output is a little more complicated function menu($item = THIS_CAT) { $menuf = file(MENU); $menuf = array_map('trim', $menuf); $key = array_search($item, $menuf); setPointer($menuf, $key); $prev = prev($menuf); setPointer($menuf, $key); $next = next($menuf); if($prev !== false) { $nav = "\n".'$prev'; } if($next !== false) { $nav .= "\n".'$next'; } well i can't make it show prev<-prev<-prev | next->next->next -3 -2 -1 1 2 3 Link to comment https://forums.phpfreaks.com/topic/47172-nextprev-more-next-and-prev-help-reques/ Share on other sites More sharing options...
boo_lolly Posted April 16, 2007 Share Posted April 16, 2007 what exactly is the problem? Link to comment https://forums.phpfreaks.com/topic/47172-nextprev-more-next-and-prev-help-reques/#findComment-230025 Share on other sites More sharing options...
dheaven69 Posted April 16, 2007 Author Share Posted April 16, 2007 well this code works but i can't make it output more then this Link to comment https://forums.phpfreaks.com/topic/47172-nextprev-more-next-and-prev-help-reques/#findComment-230030 Share on other sites More sharing options...
boo_lolly Posted April 16, 2007 Share Posted April 16, 2007 you can't make it output more than what? and what are you trying to make it output? and what is the desired effect of each of the links? help me help you. Link to comment https://forums.phpfreaks.com/topic/47172-nextprev-more-next-and-prev-help-reques/#findComment-230035 Share on other sites More sharing options...
dheaven69 Posted April 16, 2007 Author Share Posted April 16, 2007 ah sorry for the poor explanation this are my first days of php this was build for a simple navigational menu that shows the previous and the next link. what i wish from this is to show the previous before previous ..... and the next after next .... links (more the n 2 links) Link to comment https://forums.phpfreaks.com/topic/47172-nextprev-more-next-and-prev-help-reques/#findComment-230039 Share on other sites More sharing options...
boo_lolly Posted April 16, 2007 Share Posted April 16, 2007 ok, there are hundreds of ways to do what you want. first, it is called 'pagination'. go to www.google.com and search for tutorials. if you don't understand it after that, then come to the forums. Link to comment https://forums.phpfreaks.com/topic/47172-nextprev-more-next-and-prev-help-reques/#findComment-230045 Share on other sites More sharing options...
dheaven69 Posted April 16, 2007 Author Share Posted April 16, 2007 ok thanks i'll search some more but all i could digg in the last 2 days was involving mysql, but i think i just found what i need Link to comment https://forums.phpfreaks.com/topic/47172-nextprev-more-next-and-prev-help-reques/#findComment-230053 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.