Jump to content

next/prev more next and prev. help reques


dheaven69

Recommended Posts

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

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)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.