Tags:
create new tag
, view all tags
FranzJosefGigler - 12 Sep 2007:

Carlo, have you ever tried TreeBrowserPlugin?


CarloSchulz - 13 Sep 2007:

I tried to combine it with TreePlugin but I had give up on this one because it didn't work as documented.


MarcoSilva - 16 Sep 2007:

Nice tip, I would like to try but without the TreePlugin? , using only inline search did you try ? Maybe with METASEARCH variable. Anyway thks the tip.


SteveJonesST - 19 Sep 2007:

Hi Carlo.

I got the TreeBrowser and TreePlugin working together like this:

%TREEBROWSER{"thread" title="<h3>Topic Tree Of %WEB%</h3>" openAll="on"}%
%TREEVIEW{formatting="outline" format="* [[$topic]]" levelprefix="   "}%

I put one of these in every new web created. Hope it's helpful.


JacekZapotoczny - 20 Sep 2007:

We wanted to publish sitemaps from selected webs on a Main. To do this we've used formatting as stated above by Steve. But unfortunately including such a number of sitemaps to a single topic was time consuming while the loading time of a homepage was crucial for us. Then we've found a plugin combination which helped us (TwistyPlugin, TreePlugin, TWikiAjaxContrib). Here I'll try to explain the essentials.

First (TreePlugin) for each web there was created a WebSiteMap topic with the following content:

%TREEVIEW{web="%WEB%" excludetopic="Web*"  formatting="outline" format="* [[%WEB%.$topic][$topic]] " levelprefix="   "}% 

Next (TwistyPlugin) On Main.WebHome we've defined for each of the topics the following:

[[WEB1.%HOMETOPIC%][ __WEB1 web__ ]]
%TWISTY{id="WEB1SiteMap" mode="div" showlink="Show !SiteMap..." hidelink="Hide !SiteMap" 
showimgleft="%ICONURLPATH{toggleopen-small}%"  
hideimgleft="%ICONURLPATH{toggleclose-small}%" remember="on"}%
<div id="WEB1SiteMap" style="border-left:1px solid grey"></div>
%ENDTWISTY%

[[WEB2.%HOMETOPIC%][ __WEB2 web__ ]]
%TWISTY{id="WEB2SiteMap" mode="div" showlink="Show !SiteMap..." hidelink="Hide !SiteMap" 
showimgleft="%ICONURLPATH{toggleopen-small}%"  
hideimgleft="%ICONURLPATH{toggleclose-small}%" remember="on"}%
<div id="WEB2SiteMap" style="border-left:1px solid grey"></div>
%ENDTWISTY%

(...)
where WEB1 and WEB2 are the names of existing webs.

And last (TWikiAjaxContrib), we've added some JS code to fill up div's with a content on demand (onclick).

To do that first add some JS to the page header with %AJAX% tag placed at the begining of the page. Then place the following to the bottom of the page.

<script type="text/javascript">
// <![CDATA[
// Load onclick
   twiki.AjaxRequest.setProperties( "WEB1SiteMap", {container:"WEB1SiteMap", url:"%SCRIPTURL{"view"}%/WEB1/WebSiteMap?skin=text", cache:true });
   twiki.AjaxRequest.setProperties( "WEB2SiteMap",   {container:"WEB2SiteMap",   url:"%SCRIPTURL{"view"}%/WEB2/WebSiteMap?skin=text", cache:true });

var myrules = {
   '#WEB1SiteMapshow' : function(el) {
      var oldOnClick = el.onclick;
      el.onclick = function() {
         twiki.AjaxRequest.load("WEB1SiteMap");
         oldOnClick();
         return false;
      }
   },
   '#WEB2SiteMapshow' : function(el) {
      var oldOnClick = el.onclick;
      el.onclick = function() {
         twiki.AjaxRequest.load("WEB2SiteMap");
         oldOnClick();
         return false;
      }
   }
};

Behaviour.register(myrules);

//Failure handler
function handleFailed(inName, inStatus) {
   var msg = "<div style=\"background:#ffc; padding:.5em;\">" + 
      "Could not load contents." + 
      "<\/div>";
   twiki.HTML.setHtmlOfElementWithId(inName, msg);
//   alert(msg);
}
// ]]>
</script>

TIP The trick is we don't load WebSiteMaps just on homepage open but only when the user requests it. This saves a lot of time on homepage load which takes now 1.6s according to Apache Benchmark. And the last but not least it looks pretty fancy on the page wink


CarloSchulz - 20 Sep 2007:

Sweet, thanks a lot everyone. Will try to refactor this into a new article.


SeanCMorgan - 27 Aug 2008:

For more on this subject, see HowToEditWebTopicList.

Since I wrote that, I've decided not to reparent the orphaned pages, but rather just to leave them out of the tree by default (and a link to refresh the page with the orphans showing). That's because all my 'adoption' work on the TWiki web was lost when I upgraded.

I also moved the alphabetical list to a separate topic (instead of hiding it in a twisty) to make the page load faster.

P.S. MarcoSilva (16 Sep 2007) wrote, "I would like to try but without the TreePlugin". You can make a SiteMapUsingNestedSearch, but I wouldn't recommend it (TreePlugin is faster).


Topic revision: r7 - 27 Aug 2008 - 16:24:27 - SeanCMorgan
 
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback