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

less than 10 discussions per page

edited October 2008 in Vanilla 1.0 Help
Hi, is there a way to display less than ten discussions per page? I want to display just five instead of the ten which are the minimum value in the settings. thanks in advance trash


  • Open appg/settings.php and change line 101 from $Configuration['DISCUSSIONS_PER_PAGE'] = '30'; to $Configuration['DISCUSSIONS_PER_PAGE'] = '5'; But remember, every time you save the Application Settings page it will change it back to a multiple of 10, so you will have to change it again. But it shouldn't be a problem because that page isn't a frequently used one.
  • would it not be better to add
    $Configuration['DISCUSSIONS_PER_PAGE'] = '5'; To the conf/setting.php

    because when you upgrade the setting will be lost
  • Curiously enough is there anyway to hardcode a maximum number of discussions per page without having the program refer to the settings page for this?
  • Sure there is but the real question should be why would you want to? The most efficient way is to do what we said, and Simonb's suggestion is the best one for upgradeability.
    But you could also change the while loop (doing double-shifts as a for loop it seems in this case XD) on lines 47 to 51 of themes/settings_globals_form.php to this:$i = 5; while ($i < 101) { $Selector->AddOption($i, $i); $i += 5; }That should just give you the option in the settings page to select from multiples of 5 instead of multiples of 10.
  • The reason is that I run vanilla on my website but I also run a version (same database) with each category embedded in a web page. On the embedded version I only want 10 discussions to appear whereas on the full version I want the normal number of discussions to appear. So basically in the code for the category display in the embedded version I need to hardcore a setting that doesn't refer to the figure set up on the settings page. I hope that's clearer than it looks :-)
  • So to summarise - how/where would I modify the code so that the category only displayed a certain number of discussions without refering to the amount that is normally set within the 'Settings'?
  • Ah ok. Well try this:
    Open library/Vanilla/Vanilla.Control.DiscussionGrid.php and change line 56 to:
    $this->DiscussionData = $DiscussionManager->GetDiscussionList(10, $this->CurrentPage, $CategoryID);
    and line 84 to:
    $pl->RecordsPerPage = 10;
    That should bypass the settings.
  • @SubJunk

    upgrading your installations must be tricky...
  • edited October 2008
    @subjunk Thanks - that works but it involves moving another file into the embed mod and I'm trying to keep the number down. Grahack has come across with an elegent & short solution that just involves addition to the embed mod index file!
  • To miquel. Not really because when I make changes to the core files I always contain them within comments, like // Start of custom code if (blabla... // End of custom code
    so then when I upgrade I just do a full upgrade and then search for "// Start of custom code" in my latest backup (automatic backups every night) in every file at once using Dreamweaver, so every time it finds that string I just copy it over to the new installation. It's very easy to maintain code changes when you have that system, especially when the code is only updated once a year if that ;)

    To Abacus: Awesome :)
  • the problem is that other people don't follow your maintenance process but do apply your fixes, maybe without noticing that they may feel disappointed when this "once-a-year" update occurs.

    I mean, don't get me wrong, if you have such a very organized method, it's ok, 'cause you seem to be skilled enough,
    but for other users not-so-skilled in programming, maybe they need a vanilla-ish solution, don't edit the core, lots of things can be done without the need of doing it...it's less straightforward, I know, but will work almost sure when they upgrade their system
  • Yes you're right
This discussion has been closed.