Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Category navigation: a small modification to CategoryJumper

Max_BMax_B New
edited August 2006 in Vanilla 1.0 Help
I wrote somewhere in a discussion about this recurrent question of category navigation that, IMO, the best answer would be a slight modification to Mark's CategoryJumper extension: keep the selected category, from the sidepanel select or from the categories page, active until user deliberatly select to see all categories.
Here it is. Only a few lines are added to hte extension code so I see no reason to make another one.
Find the right place in CategoryJumper/default.php (around line #26) and add the lines between the two comments.

if (!$CategoryData) { return ''; } else { //mod Max_B: stick the category setting $sess_cat = isset($_GET['CategoryID']) ? $_GET['CategoryID'] : -1; if ($sess_cat == -1) { if (isset($_SESSION['CategoryJumper'])) $_GET['CategoryID'] = $_SESSION['CategoryJumper']; } elseif ($sess_cat == 0) { unset($_SESSION['CategoryJumper']); unset($_GET['CategoryID']); } else { $_SESSION['CategoryJumper'] = $sess_cat; } //end mod $Select = $Context->ObjectFactory->NewObject($Context, 'Select'); $Select->Name = 'CategoryID';
then change the line reading:
$Select->Attributes = "onchange=\"document.location='".$Context->Configuration['WEB_ROOT']."'+(this.options[this.selectedIndex].value > 0 ? '?CategoryID='+this.options[this.selectedIndex].value : '');\"";
to
$Select->Attributes = "onchange=\"document.location='".$Context->Configuration['WEB_ROOT']."'+(this.options[this.selectedIndex].value > 0 ? '?CategoryID='+this.options[this.selectedIndex].value : '?CategoryID=0');\"";
Post-scriptum edit: If you use FriendlyUrl, you should modify the relevant line instead of the one above. I didn't do it since i'm not able to test right now.

Comments

  • @Max: I have tried the patch and it works nicely.

    I think the use of the category jumper is more intuitive in this way. When the user selects something it keeps selected until she decides to change it. After browsing a given discussion you come back to the same discussion list where you were previously. I think it is really apropriate for forums with strong category structure.

    However, for people used to the old way it is a little annoying at first. I was so used to click in the Discussions tab to get the whole list that now I forget I should use the category jumper to do it ;-)
  • Do you have a link example so I can see it in action please? ;x
  • @blizeh: Sorry, no. I'm setting up a large web application, and it's far from being online. Hope some other folk will activate it somewhere.
  • I just made the change on my local install and it works fine. It is more intuitive (at least for me) and should work well on my new teaching forum. I'll have to add it to my instructions on using a forum. Thanks, jim
This discussion has been closed.