Jump to content

leoric

Members
  • Posts

    39
  • Joined

  • Last visited

Posts posted by leoric

  1. I think this should work but you can also do

    $user->user_app->remove($page);
    

    hi ,soma 

    before this i had tried to use "remove" ,but it does not work. so i change to "removeAll"

    and i found :

    if there have this pages in page field [Multiple pages (PageArray)]:

    page1 , page2, page 3..etc

    removeall() : will remove all pages      =>    its worked      :rolleyes:

    removeall(page1): page1 will be removed. => its worked   :rolleyes:

    remove(page1):  nothing changed..   => its not working   :(

  2. add a question , 

    this code not work( jquery version: 1.9)

            $('.ajaxSearch_close')
                .live('click',function(){
                    $(this).closest('#ajaxSearch').fadeOut();
                });
    you can use this replace it
        $(document).on("click", ".ajaxSearch_close", function (e) {
            $(this).closest('#ajaxSearch').fadeOut();
        });        
    • Like 2
  3. i used soma 's AJAX PAGE SEARCH module today

    i found a issue after test:  when i type a keywords not use letter or number (chinese keywords) ,the result will return "Please enter a search term in the search box (upper right corner)...", obviously the search.php cant get inputbox "q"'s value..thise issue just happend on IE. Chrome and FireFox work ok.

    then i open AjaxSearch.js,

    find "data: param_name+"="+value," (line 76)  

    replace into "data: param_name+"="+encodeURI(value),"

    and its working..

    nice module, thank you ,soma!

    post-1860-0-04731000-1383631115_thumb.jp

    • Like 1
  4. hi,everyone!

    i have two issues :-X  :

    -----------------------------------------------------------------------------------------------------------------------------------------

    1.the first (serious):

    there is a page tree like this in my site backend :

    site

       category A

            child-id  1

            child-id  2

            child-id  3

              ..

             newest page...

       category B

            child-id  1

            child-id  2

            child-id  3

           ...

             newest page...

       category C

            child-id 1

            child-id 2

            child-id 3

           ...

             newest page...

    and i wana be this: (some category's children reverse sort by id/created ,such as category A and C  ; there two cateogries have unlimited articles.):

    site

       category A

             newest page...

              ..

            child-id  3

            child-id  2

            child-id  1

       category B

            child-id  1

            child-id  2

            child-id  3

           ...

             newest page...

       category C

             newest page...

              ..

            child-id  3

            child-id  2

            child-id  1

    then i do this manipulate:

    edit page" category A/C" -> children ->sort settings -> children sortted by (created) And checked "Reverse sort direction?"

    after this manipulate,i found its not working ,there nothing be changed  :(

    at last i use this module : "Pagetree Add New Childs Reverse" http://modules.processwire.com/modules/page-tree-add-new-childs-reverse/

    after module configuration completed, its still not working.

    --------------------------------------------------------------------------------------------------------------------------------------------------------

    2.another one is very funny:

    category A and category C have pagination. (code:  $page->children("limit=12,sort=-id"); )

    in frontend page, if i login system, in front page  the sort is not work ,when i logout its working. like this:

    when i logged in ( sort=-id, not work):

    page-id 1

    page-id 2

    page-id 3

    page-id 4

    ...

    but when i logout( sort=-id, work correct)

    page-id 4

    page-id 3

    page-id 2

    page-id 1

    ...

    --------------------------------------------------------------------------------------------------------------------------------------------------------

    what caused those issue?

    it looks like when i login system "sort=-id/sort=-created" will not work. 

    i had read so many topics but they cant solve my issue.

    ----------------------------------------------------------------------------------------------------------------------------------------------------------

    PS:

    these days i have been using PW do my project. and there are many problems have been resolved in forums.

    in the fact its difficult for me learn PW(i am from china,there no chinese PW helpful resource in internet),my english is not good enough.most of the time i have to use dictionary.but i really like PW.

    thanks!

  5. Thanks for the details explanation - the behavior you are seeing when using ->sort("-id") is expected and working as intended. I don't really understand why the other approach is not working as it should.

    I am not sure how you are comparing the output titles to the IDs, so maybe just to be sure can you try: 

    echo '<li><a href="'.$item->url.'">'.$item->title.' ('.$item->id.')</a></li>'; 
    

    Just in case the your expected order is not actually based on the ID, but rather on your manually sorted order. Which is also why I suggested the -sort option. Sorry if you do have this right - sometimes it can be easy to overlook the simplest things. Maybe also try the selector in the selector test module which will output all the information about each page, including the ID.

    i am back...

    omg,its working

    i dont changed something,just do as you say : add "$item->id" then i found its work correctly 

    its a big joke,i think if the cache caused?  my work space in localhost (appserv + win7 x64)

    @adrian thank you very much!

    • Like 1
  6. 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.

  7. @adrian @teppo

    i am sorry for my expression is not clear.  and i want to do like this

    article id:  1 2 3 4  5  6  7 8 9 10  11 12 ...

    page 1

    12 11 10 9

    page 2

    8 7 6 5 

    page 3

    4 3 2 1

    ...

    but when i use this code

    "$matches=$pages->find("parent_id=$page->id, limit=5,sort=-id");" or "$matches = $page->children("limit=5,sort=-id");"

    its not working..

    if i use "$matches=$pages->find("parent_id=$page->id, limit=5")->sort("-id")";

    the result will be this:

    article id:  1 2 3 4  5  6  7 8 9 10  11 12 ...

    page 1

    4 3 2 1

    page 2

    8 7 6 5

    page 3

    12 11 10 9

    ...

  8. Maybe I am not following what you need exactly, but I think this might work for you:

    $matches = $page->children("limit=5,sort=-id");
    

    thank you for you reply,adrian

    in the fact,i try do this earlier,but the problem is still  :(

  9. 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

  10.                 <?php              
                        $matches=$pages->find("parent_id=$page->id, limit=5,sort=-id");
                        $pagination = $matches->renderPager();
                        echo $pagination;
                           echo '<ul class=rows>';
                        foreach($matches as $item)
                        {
                               echo '<li><a href="'.$item->url.'">'.$item->title.'</a></li>';                    
                            }
                        echo '</ul>';
                        echo $pagination;                         
                     ?>   
    

    hi , this is my code , the problem is  "sort=-id" isnot working 

    this is some articles in many pages.

    when i use "$matches=$pages->find("parent_id=$page->id, limit=5)->sort("-id");" 

    then i found the articles order by -id in current  page,but i want to  them work in all of the pages.

    and if i use "sort=-title/title" replace "sort=id/-id" ,its working perfect.

    whats wrong with this? thank you !

×
×
  • Create New...