How to use Treesaver for dynamic contents

304 views
Skip to first unread message

Jathon zhu

unread,
May 23, 2011, 5:58:51 AM5/23/11
to Treesaver
I found the treesaver can only be used for static content.
If I want to use it in dynamic content,what am I gonna to do?

Thank you!

Bram Stein

unread,
May 23, 2011, 6:31:58 AM5/23/11
to trees...@googlegroups.com
Hi,

What exactly do you mean by dynamic content? With the latest changes
you should able to dynamically update the Table Of Contents and also
insert client-side generated documents (content retrieved through an
XHR.) These changes are not in an official release yet, but they are
available in the Github repository
(https://github.com/Treesaver/treesaver). If you are interested, I
could do a quick write-up on how to use it (I have to document it
anyway.)

Best regards,

Bram

Zhengjun

unread,
Jun 1, 2011, 6:49:12 AM6/1/11
to Treesaver
Hi Bram,

I am using treesaver to develop a online news reader. it's a great
lib. Thanks for all your good work. Just let you know, I am also
interested in that how treesaver is used with dynamic content.

Regards,

Zhengjun

MOHAK R

unread,
Jun 1, 2011, 9:46:03 AM6/1/11
to trees...@googlegroups.com
hey it works with dynamic content very well..

eathon zhu

unread,
Jun 1, 2011, 11:09:06 AM6/1/11
to trees...@googlegroups.com

I do need to dynamically update the table of contents,so it is usefull to me if you do a quick write-up on how use it.Thank you!

Scott Kellum

unread,
Jun 6, 2011, 2:05:08 AM6/6/11
to Treesaver
If you wish to personalize a toc then you should do this through the
CMS, not on the front-end. Because I am unclear as to what exactly you
need to do it is hard to help.

For example, if you want to search for all articles relating to
politics then when the user clicks on the search button they should be
redirected to a publication with a server generated toc.html file
containing all the related articles.

Treesaver will not handle a "hide this section" button that cuts
content without refreshing the page. All TOC revisions will need to
happen on the server side to be pushed on page refresh.

On Jun 1, 11:09 am, eathon zhu <eas...@gmail.com> wrote:
> I do need to dynamically update the table of contents,so it is usefull to me
> if you do a quick write-up on how use it.Thank you!

Bram Stein

unread,
Jun 6, 2011, 5:01:29 PM6/6/11
to trees...@googlegroups.com
Hi,

Sorry for the late response. I've added an example of how to use
Treesaver for dynamic content. Be aware that you will need the new (and
unreleased) version of Treesaver for this. It will not work on
treesaver-0.9.2.js. (It will most likely be in Treesaver 0.9.3.)

https://github.com/bramstein/treesaver/tree/master/examples/dynamic-toc

Have a look at the "my.js" JavaScript file, it sets up an event listener
for the LOADED event fired by the index. Once the index is loaded it
hooks up event listeners for four buttons. Each of the buttons add a new
document to the table of contents. The first three add existing
documents, while the last button dynamically inserts a new article.

For now, this only works in debug mode---I haven't exported the right
methods and events yet (minor issue.) I would love to know more about
your use case so I can decide on how much of the API to expose.

Bram

On 2011-06-01 17:09, eathon zhu wrote:
> I do need to dynamically update the table of contents,so it is usefull
> to me if you do a quick write-up on how use it.Thank you!

> 锟斤拷 2011-5-23 锟斤拷锟斤拷6:32锟斤拷"Bram Stein" <b.l....@gmail.com
> <mailto:b.l....@gmail.com>>写锟斤拷锟斤拷

Pavel M

unread,
Jun 12, 2011, 7:15:50 AM6/12/11
to Treesaver
Hi,

I don't know why but I see only blank screen.
Any ideas?


Regards,

Pavel


On 6 июн, 17:01, Bram Stein <b.l.st...@gmail.com> wrote:
> Hi,
>
> Sorry for the late response. I've added an example of how to use
> Treesaver for dynamic content. Be aware that you will need the new (and
> unreleased) version of Treesaver for this. It will not work on
> treesaver-0.9.2.js. (It will most likely be in Treesaver 0.9.3.)
>
> https://github.com/bramstein/treesaver/tree/master/examples/dynamic-toc
>
> Have a look at the "my.js" JavaScript file, it sets up an event listener
> for the LOADED event fired by the index. Once the index is loaded it
> hooks up event listeners for four buttons. Each of the buttons add a new
> document to the table of contents. The first three add existing
> documents, while the last button dynamically inserts a new article.
>
> For now, this only works in debug mode---I haven't exported the right
> methods and events yet (minor issue.) I would love to know more about
> your use case so I can decide on how much of the API to expose.
>
> Bram
>
> On 2011-06-01 17:09, eathon zhu wrote:
>
>
>
>
>
>
>
> > I do need to dynamically update the table of contents,so it is usefull
> > to me if you do a quick write-up on how use it.Thank you!
> > 2011-5-23 6:32 "Bram Stein" <b.l.st...@gmail.com
> > <mailto:b.l.st...@gmail.com>>д

Bram Stein

unread,
Jun 15, 2011, 3:24:32 AM6/15/11
to trees...@googlegroups.com
Do you get any errors or warnings in your console?

2011/6/12 Pavel M <mobil...@gmail.com>:

Pavel M

unread,
Jun 15, 2011, 3:12:16 PM6/15/11
to Treesaver
Nothing.
But when I see Apache access log I see the next:
127.0.0.1 - - [15/Jun/2011:22:09:39 +0300] "GET /treesaver/examples/
dynamic-toc/ HTTP/1.1" 304 - "http://localhost/treesaver/examples/"
"Mozilla/5.0 (Windows NT 6.1) AppleWebKit/534.30 (KHTML, like Gecko)
Chrome/12.0.742.91 Safari/534.30"
127.0.0.1 - - [15/Jun/2011:22:09:39 +0300] "GET /treesaver/examples/
treesaver.css HTTP/1.1" 304 - "http://localhost/treesaver/examples/
dynamic-toc/" "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/534.30 (KHTML,
like Gecko) Chrome/12.0.742.91 Safari/534.30"
127.0.0.1 - - [15/Jun/2011:22:09:39 +0300] "GET /treesaver/lib/
mustache/mustache.js HTTP/1.1" 304 - "http://localhost/treesaver/
examples/dynamic-toc/" "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/
534.30 (KHTML, like Gecko) Chrome/12.0.742.91 Safari/534.30"
127.0.0.1 - - [15/Jun/2011:22:09:39 +0300] "GET /treesaver/lib/closure/
goog/base.js HTTP/1.1" 304 - "http://localhost/treesaver/examples/
dynamic-toc/" "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/534.30 (KHTML,
like Gecko) Chrome/12.0.742.91 Safari/534.30"
127.0.0.1 - - [15/Jun/2011:22:09:39 +0300] "GET /treesaver/test/
deps.js HTTP/1.1" 304 - "http://localhost/treesaver/examples/dynamic-
toc/" "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/534.30 (KHTML, like
Gecko) Chrome/12.0.742.91 Safari/534.30"
...etc

Errors code 304.

Regards,

Pavel




On 15 июн, 03:24, Bram Stein <b.l.st...@gmail.com> wrote:
> Do you get any errors or warnings in your console?
>
> 2011/6/12 Pavel M <mobilpr...@gmail.com>:
>
>
>
>
>
>
>
> > Hi,
>
> > I don't know why but I see only blank screen.
> > Any ideas?
>
> > Regards,
>
> > Pavel
>
> > On 6 ÉÀÎ, 17:01, Bram Stein <b.l.st...@gmail.com> wrote:
> >> Hi,
>
> >> Sorry for the late response. I've added an example of how to use
> >> Treesaver for dynamic content. Be aware that you will need the new (and
> >> unreleased) version of Treesaver for this. It will not work on
> >> treesaver-0.9.2.js. (It will most likely be in Treesaver 0.9.3.)
>
> >>https://github.com/bramstein/treesaver/tree/master/examples/dynamic-toc
>
> >> Have a look at the "my.js" JavaScript file, it sets up an event listener
> >> for the LOADED event fired by the index. Once the index is loaded it
> >> hooks up event listeners for four buttons. Each of the buttons add a new
> >> document to the table of contents. The first three add existing
> >> documents, while the last button dynamically inserts a new article.
>
> >> For now, this only works in debug mode---I haven't exported the right
> >> methods and events yet (minor issue.) I would love to know more about
> >> your use case so I can decide on how much of the API to expose.
>
> >> Bram
>
> >> On 2011-06-01 17:09, eathon zhu wrote:
>
> >> > I do need to dynamically update the table of contents,so it is usefull
> >> > to me if you do a quick write-up on how use it.Thank you!
> >> > 2011-5-23 6:32 "Bram Stein" <b.l.st...@gmail.com
> >> > <mailto:b.l.st...@gmail.com>>Ä
>
> >> > š> Hi,
>
> >> > š> What exactly do you mean by dynamic content? With the latest changes
> >> > š> you should able to dynamically update the Table Of Contents and also
> >> > š> insert client-side generated documents (content retrieved through an
> >> > š> XHR.) These changes are not in an official release yet, but they are
> >> > š> available in the Github repository
> >> > š> (https://github.com/Treesaver/treesaver). If you are interested, I
> >> > š> could do a quick write-up on how to use it (I have to document it
> >> > š> anyway.)
>
> >> > š> Best regards,
>
> >> > š> Bram
>
> >> > š> On Mon, May 23, 2011 at 11:58 AM, Jathon zhu <eas...@gmail.com
> >> > <mailto:eas...@gmail.com>> wrote:
> >> > š> > I found the treesaver can only be used for static content.
> >> > š> > If I want to use it in dynamic content,what am I gonna to do?
>
> >> > š> > Thank you!

Bram Stein

unread,
Jun 16, 2011, 3:53:39 AM6/16/11
to trees...@googlegroups.com
Di you mean there is nothing in the JavaScript console? The 304's in
your Apache log are normal (and not error codes), it just means the
files haven't been modified since the last time you tried to access
them. Are any of the other examples working for you?

Pavel M

unread,
Jun 16, 2011, 12:38:40 PM6/16/11
to Treesaver
Unfortunately no. Only blank screen.
The settings of php_value display_errors on
And I don't know the reason because I already tested previous versions
of treesaver and all were good.
Also I can't see any error in Apache logs.

Pavel

Bram Stein

unread,
Jun 18, 2011, 7:12:42 PM6/18/11
to trees...@googlegroups.com
Hi,

I meant your JavaScript console/debugger (like Firebug, or Chrome
developer tools.) Is there any indication of something going wrong there?

Thanks,

Bram

Ricky

unread,
Jul 8, 2011, 7:08:58 PM7/8/11
to Treesaver
Testing treesaver for a hacking project and ran into this issue.

It seems that the reason the page is blank is because this file is
missing.
treesaver/src/modules.js

Also, the deps.js file from goog/closure is missing too (but for that
I could just download from
http://code.google.com/p/closure-library/source/browse/trunk/closure/goog/deps.js?r=827).

Here is the log

chrome-extension://pgphcomnlaojlmmcjmiddhdapjpbgeoc/infopasser.js:
8Being Called
debug.js:58[0s] Running in DEBUG mode
modules.jsGET http://192.168.3.16/~<myfolder name>/treesaver/src/
modules.js 404 (Not Found)
scriptloader.js:13Uncaught TypeError: Cannot call method 'get' of
undefined
debug.js:58[0.041s] Begin Treesaver booting
debug.js:58[0.042s] Capability classes: js canvas localstorage video
applicationcache fontface no-touch csstransforms no-csstransforms3d
csstransitions svg inlinesvg smil svgclippaths treesaver flash no-
orientation no-legacy no-mobile no-smallscreen no-cached no-nativeapp
browser-chrome os-mac
debug.js:58[0.043s] Loading resources from: resources.html
debug.js:58[0.044s] XHR request to: resources.html

boot.js:67Uncaught TypeError: Cannot call method 'get' of undefined
<---- This is probably related to the fact that modules.js is
missing ??? ---//

debug.js:58[0.089s] XHR response from: resources.html
debug.js:58[0.254s] DOM event received: readystatechange
debug.js:58[0.254s] DOM event received: DOMContentLoaded
debug.js:58[0.255s] DOM is ready
chrome-extension://gcamgngbdaiibdbikdfmjinnmgoppecp/js/back.js:
608current url match : false
chrome-extension://pgphcomnlaojlmmcjmiddhdapjpbgeoc/mailto.js:55Got
message from bg page - https://mail.google.com/mail/?view=cm&fs=1&tf=1
chrome-extension://pgphcomnlaojlmmcjmiddhdapjpbgeoc/mailto.js:
24Starting to rewrite mailtos

Bram Stein

unread,
Jul 11, 2011, 6:59:37 AM7/11/11
to trees...@googlegroups.com
Ah, thanks for reporting that, it explains the earlier reports. To use
a debug build of Treesaver you will need to run the build tool
once---this will generate the `modules.js` file. If you satisfy all
the dependencies for building you can simply type `paver` on the
command line. This should solve the problem.

The deps.js file from Google Closure is actually not required: there
is an option to switch loading it off (add `window.CLOSURE_NO_DEPS =
true;` to a script tag before loading Closure/Treesaver.)

Let me know if you run into any problems,

Bram

Ricky

unread,
Jul 11, 2011, 6:32:43 PM7/11/11
to Treesaver
It works now. Nice. Whats the plan on making this into the proper
distribution? (for my use-case, I'm getting some dynamic data from
Facebook and other 3rd party services).

On Jul 11, 3:59 am, Bram Stein <b.l.st...@gmail.com> wrote:
> Ah, thanks for reporting that, it explains the earlier reports. To use
> a debug build of Treesaver you will need to run the build tool
> once---this will generate the `modules.js` file. If you satisfy all
> the dependencies for building you can simply type `paver` on the
> command line. This should solve the problem.
>
> The deps.js file from Google Closure is actually not required: there
> is an option to switch loading it off (add `window.CLOSURE_NO_DEPS =
> true;` to a script tag before loading Closure/Treesaver.)
>
> Let me know if you run into any problems,
>
> Bram
>
>
>
>
>
>
>
> On Sat, Jul 9, 2011 at 1:08 AM, Ricky <rickw...@gmail.com> wrote:
> > Testing treesaver for a hacking project and ran into this issue.
>
> > It seems that the reason the page is blank is because this file is
> > missing.
> > treesaver/src/modules.js
>
> > Also, the deps.js file from goog/closure is missing too (but for that
> > I could just download from
> >http://code.google.com/p/closure-library/source/browse/trunk/closure/...).
>
> > Here is the log
>
> > chrome-extension://pgphcomnlaojlmmcjmiddhdapjpbgeoc/infopasser.js:
> > 8Being Called
> > debug.js:58[0s] Running in DEBUG mode
> > modules.jsGEThttp://192.168.3.16/~<myfolder name>/treesaver/src/
> > modules.js 404 (Not Found)
> > scriptloader.js:13Uncaught TypeError: Cannot call method 'get' of
> > undefined
> > debug.js:58[0.041s] Begin Treesaver booting
> > debug.js:58[0.042s] Capability classes:   js canvas localstorage video
> > applicationcache fontface no-touch csstransforms no-csstransforms3d
> > csstransitions svg inlinesvg smil svgclippaths treesaver flash no-
> > orientation no-legacy no-mobile no-smallscreen no-cached no-nativeapp
> > browser-chrome os-mac
> > debug.js:58[0.043s] Loading resources from: resources.html
> > debug.js:58[0.044s] XHR request to: resources.html
>
> > boot.js:67Uncaught TypeError: Cannot call method 'get' of undefined
> > <---- This is probably related to the fact that modules.js is
> > missing ??? ---//
>
> > debug.js:58[0.089s] XHR response from: resources.html
> > debug.js:58[0.254s] DOM event received: readystatechange
> > debug.js:58[0.254s] DOM event received: DOMContentLoaded
> > debug.js:58[0.255s] DOM is ready
> > chrome-extension://gcamgngbdaiibdbikdfmjinnmgoppecp/js/back.js:
> > 608current url match : false
> > chrome-extension://pgphcomnlaojlmmcjmiddhdapjpbgeoc/mailto.js:55Got
> > message from bg page -https://mail.google.com/mail/?view=cm&fs=1&tf=1
Reply all
Reply to author
Forward
Message has been deleted
0 new messages