Overcome caching limitation when you call a snippet inside another snippet
on 14-Sep-2009 | Comments ( 1 ) Tags: Evolution
Uncached snippets might put a big load on you server. To solve this problem we'll have to create a new snippet and make use of runSnippet() API.
<?php
$parentparent = $modx->runSnippet("ParentParent");
$wayfinderOutput = $modx->runSnippet("Wayfinder", array('startId' => $parentparent));
return $wayfinderOutput;
?>
Because Wayfinder does not know how to get the second level parent ID of the current document, I had to create my own snippet: ParentParent. You can download this snippet here.
For readability sake, I saved the output of the ParentParent into a variable and then used it in the Wayfider call.
Not so hard! Leave a message if you know other solutions.
Write a comment
Posts: 1
Reply #1 on : Mon September 14, 2009, 18:47:38