There is a tree on the site.

Here's how it should work on the idea. Those. The branch with id=63 open. But if you go to the second page of this group, the tree collapses.

How to fix it? I understand that the script takes the address and reveals the desired group.

Here is the code .

  • Yes, it is exactly so that the menu remains open, you must either load the Ajax, or indicate the opened blocks in the link. - FLK
  • @FLK and how can you pass this already cut address to this script (without page number)? - Demyan112rv

2 answers 2

I can only assume that the last parameter of the link (page number) is confusing. I will decipher: the blocks you have open have the class "collapsable", this class is added based on the same parameter "id = 63", which is passed last in the link. If it is very primitive, then, for example, something like this:

 <li <?php echo (GET['id'] == 63 ? 'class="collapsable"' : false);?>>Принадлежности для письма и черчения.</li> 

Now there are several options for "failure". If you in mod_rewrite set the rule for redirecting all references to index.php and paring the URIs yourself, it is possible that you do not take into account that the last parameter is no longer the id with which to make a comparison. The second option - you have written separate rules, but also did not take into account the transmitted parameter with the page number.

  • I am writing on Kohana. There is a route in the route set: set ('category', '<controller> / <id> (/ <page>)', array ('controller' => 'stationery | materials | souvenirs | school', 'id' = > '[0-9] +', 'page' => '[0-9] +')) I see the solution in trimming this parameter / page when transferring it to jQuery. Only there is one problem, I don’t know JS at all, and I can’t figure out where to fix something, to cut off the address - Demyan112rv

I would do something like this:

 $('#leftmenu a').each(function(){ if(location.href.indexOf(this.href) !== -1){ //раскрыть ветку } }); 
  • If possible, in more detail. I know JS very far away ( - Demyan112rv