Jump to content

a problem about using pagination


leoric
 Share

Recommended Posts

today i use pagination found two questions

and one is

http://processwire.com/talk/topic/4751-sort-id-not-working/

and  another question is the menu of all pages  is missing. exclude first page.

the menu code is wiritten in header.inc ,i  use "include("./header.inc"); " get it.

and this is the menu code:

			<?php
				$homepage = $pages->get("/"); 
				$children = $homepage->children("limit=5");
				$children->prepend($homepage);	 //index
				foreach($children as $child) {
					$class = $child === $page->rootParent ? " class='on'" : '';
					$liclass=$child->numChildren(true) ? "  class='hmp'" : '';
					//get 2 menu
					//$finalstr='';
					if($child->numChildren(true))
					{ 
						$items=$child->children("limit=5");
						$fstr="<div class='mc'>
                    	<ul>";
						foreach($items as $item)
						{
							$fstr.="<li><a href='$item->url'>$item->title</a></li>";
							}
						$fstr.=" </ul>
                        <div class='ft'><b></b><i></i><div> </div></div>
                    </div> ";
					}

					//end					
					echo "<li$liclass><a$class href='{$child->url}'>{$child->title}</a>".$fstr."</li>";
				}
			?>   

post-1860-0-72546000-1382070028_thumb.jppost-1860-0-95674900-1382070039_thumb.jp

Link to comment
Share on other sites

Not sure if this is the problem or not, but do you have "Allow Page Numbers" checked on the URLs tab of the template of the parent page?

Are there any logged PHP errors about the include not working?

Also, for easier menu creation, take a look at Soma's Navigation module

yes,i had checked "Allow page numbs". 

the include is working, and there is no php errors    :(

thank you,adrian, i'll checking the problem well.

Link to comment
Share on other sites

ok,its done

when i delete "limit=n" the menu will work correctly , there is only one "limit=n" in the page 

and i use this instead of "limit=n"

					foreach($items as $item)
						{
							$in++;	//control nums
							if($in==6) break;

							xxxx

							}
 

thanks again!

regards!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...