aboutsummaryrefslogtreecommitdiff
path: root/jquery_drawer.module
diff options
context:
space:
mode:
Diffstat (limited to 'jquery_drawer.module')
-rw-r--r--jquery_drawer.module49
1 files changed, 27 insertions, 22 deletions
diff --git a/jquery_drawer.module b/jquery_drawer.module
index 682e506..5f759d3 100644
--- a/jquery_drawer.module
+++ b/jquery_drawer.module
@@ -185,31 +185,36 @@ function jquery_drawer_get_children($tid = NULL) {
* Menu callback.
*/
function jquery_drawer_page($tid = NULL) {
- $output = '';
- $nodes = taxonomy_select_nodes(array($tid));
- $base = variable_get('jquery_drawer_link', 'node');
- $tree = jquery_drawer_get_children($tid);
- $output .= '<ul id="drw_item" class="hidden">';
-
- // First render all nodes whose parent is $term
- while ($node = db_fetch_object($nodes)) {
- path_nodeapi($node,'load','');
- $link['title'] = $node->title;
- $link['href'] = ($node->path?$node->path:"$base/". $node->nid);
- $output .= theme('jquery_drawer_link', $link);
- }
+ static $cache = array();
- // Add other nodes
- if (is_array($tree) && !empty($tree)) {
- foreach ($tree as $term) {
- $output .= taxonomy_node_tree_list($term, 'jquery_drawer', 'hidden', $base);
+ if (!isset($cache[$tid])) {
+ $output = '';
+ $nodes = taxonomy_select_nodes(array($tid));
+ $base = variable_get('jquery_drawer_link', 'node');
+ $tree = jquery_drawer_get_children($tid);
+ $output .= '<ul id="drw_item" class="hidden">';
+
+ // First render all nodes whose parent is $term
+ while ($node = db_fetch_object($nodes)) {
+ path_nodeapi($node,'load','');
+ $link['title'] = $node->title;
+ $link['href'] = ($node->path?$node->path:"$base/". $node->nid);
+ $output .= theme('jquery_drawer_link', $link);
}
- }
- else {
- $output .= t('No content exists for this topic yet.');
- }
- $output .= '</ul></li>';
+ // Add other nodes
+ if (is_array($tree) && !empty($tree)) {
+ foreach ($tree as $term) {
+ $output .= taxonomy_node_tree_list($term, 'jquery_drawer', 'hidden', $base);
+ }
+ }
+ else {
+ $output .= t('No content exists for this topic yet.');
+ }
+
+ $output .= '</ul></li>';
+ $cache[$tid] = $output;
+ }
// Display output
echo($output);