General Community > Scripting Help

Boards on all pages?

(1/2) > >>

nend:
Is there a variable that always have the main board information? I haven't really searched the source though so may or may not be.

This is what I am trying to do, I am trying to inject some menu items, I already moved moderate options for admin to a sub menu of admin but I want to add a menu item with all the boards but I need a board array that is loaded on every page to use. The commented code is the code that demonstrates what I am trying to achieve. So forth it only works on the board index since the array only exist on it.


--- Code: --- if (isset($menu['admin']) && isset($menu['moderate'])) {
$menu['admin']['sub_buttons'][] = $menu['moderate'];
unset($menu['moderate']);
}
/*
foreach ($menu as $key => $value) {
$ret[$key] = $value;
if ($key == 'home') {
$ret['boards'] = array('title' => 'Boards','href' =>  '1');
foreach ($context['categories'] as $category) {
if (empty($category['boards']))
continue;

$ret['boards']['sub_buttons'][$category['name']] = array('title' => $category['name'],'href' =>  '1');
foreach ($category['boards'] as $board) {
$ret['boards']['sub_buttons'][$category['name']]['sub_buttons'][$board['name']] = array('title' => $board['name'],'href' =>  $board['href']);
}
}
}
}
*/

--- End code ---

Arantor:
There is no array that contains every board, mostly because of the performance connotations on it - different groups can see different boards.

You'll have to load them yourself, and if you decide to do so, be careful about caching (make the user's groups part of the cache key, ideally sorting them first)

nend:
That is what I was thinking.

The only problem I would probably have with caching is it expiring.

Maybe I'll trick the cache...
- Put a very high value in there where it will not expire. (Say like 10 years, lol)
- On board index since the array is already loaded compare it with the cache data, if it doesn't match force a cache update.

*edit
Are boards cached already?

Arantor:
The list of boards is not properly cached if I remember rightly, and again you still have to do it based on groups' access to them, unless all your moderators can see *every* board.

You could cache it for a very long time, and update the edit board functions to flush the cache then.

nend:
Just one question, how does the "Jump to" feature work, is it a AJAX call back to the script or is it loaded with the page?

Navigation

[0] Message Index

[#] Next page

Go to full version