Getting page content through javascript
Hi, I'm attempting to do a little AJAX-type stuff and I need a way to grab just the contents of a particular page without all the headers, sidebars and footers, but with the standard rendering (tags, plugins, etc) working. Basically, if I have a page "Main.testpage" containing this: I am some [somelink>text]. I'd like to be able to make a javascript call to some url and get the rendered page: I am some <a href="somelink">text</a>. (Notice there's no headers, menus, edit buttons, etc.) I've been looking into the xwiki source. I was hoping there was something like a "justcontents" action (ie "http://sitename/xwiki/bin/justcontents/Main/testpage"), but there doesn't appear to be. I found the xmlrpc interface, but there's a few issues to overcome, one of which is that I'd somehow have to get and store the username and password in the javascript (on the client side) to make the login token for the getPage() function. If there is nothing simple built-in, and xmlrpc is the only way, is there a good way around the password issue? (or even how to get the password)? Anyone try something similar? Am I going about this in the entirely wrong way? Thanks, -Tom -- Tom Kliethermes
Hi, Could the 'plain' template be what you are looking for? It allows you to get the rendered content of a page without headers, footers, sidebars etc... with a simple http request. You can specify the template with the xpage param on the query string. For example, here is the xwiki.org homepage put through the plain template: http://www.xwiki.org/xwiki/bin/view/Main/WebHome?xpage=plain I use this template to asynchronously grab content from other wiki pages & dump it within divs in the current page, which I think is similar to what you want to do. If you wanted raw content, you can even do: http://www.xwiki.org/xwiki/bin/view/Main/WebHome?xpage=plain&raw=1 Check out the 'plain' template code to understand how this works ( http://openmpt.xwiki.com/xwiki/templates/plain.vm ) and remember you can create custom templates if this doesn't quite suite your needs. Cheers, Robin. On 11/09/06, Thomas Kliethermes <[email protected]> wrote:
Hi, I'm attempting to do a little AJAX-type stuff and I need a way to grab just the contents of a particular page without all the headers, sidebars and footers, but with the standard rendering (tags, plugins, etc) working.
Basically, if I have a page "Main.testpage" containing this: I am some [somelink>text].
I'd like to be able to make a javascript call to some url and get the rendered page: I am some <a href="somelink">text</a>.
(Notice there's no headers, menus, edit buttons, etc.)
I've been looking into the xwiki source. I was hoping there was something like a "justcontents" action (ie "http://sitename/xwiki/bin/justcontents/Main/testpage"), but there doesn't appear to be.
I found the xmlrpc interface, but there's a few issues to overcome, one of which is that I'd somehow have to get and store the username and password in the javascript (on the client side) to make the login token for the getPage() function.
If there is nothing simple built-in, and xmlrpc is the only way, is there a good way around the password issue? (or even how to get the password)?
Anyone try something similar? Am I going about this in the entirely wrong way?
Thanks, -Tom
-- Tom Kliethermes
-- You receive this message as a subscriber of the [email protected] mailing list. To unsubscribe: mailto:[email protected] For general help: mailto:[email protected]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Why yes, yes it is! Thanks for the quick turnaround. Thanks again, -Tom -- Tom Kliethermes "Robin Fernandes" <[email protected]> 09/11/2006 03:33 PM Please respond to [email protected] To [email protected] cc Subject Re: [xwiki-users] Getting page content through javascript Hi, Could the 'plain' template be what you are looking for? It allows you to get the rendered content of a page without headers, footers, sidebars etc... with a simple http request. You can specify the template with the xpage param on the query string. For example, here is the xwiki.org homepage put through the plain template: http://www.xwiki.org/xwiki/bin/view/Main/WebHome?xpage=plain I use this template to asynchronously grab content from other wiki pages & dump it within divs in the current page, which I think is similar to what you want to do. If you wanted raw content, you can even do: http://www.xwiki.org/xwiki/bin/view/Main/WebHome?xpage=plain&raw=1 Check out the 'plain' template code to understand how this works ( http://openmpt.xwiki.com/xwiki/templates/plain.vm ) and remember you can create custom templates if this doesn't quite suite your needs. Cheers, Robin. On 11/09/06, Thomas Kliethermes <[email protected]> wrote:
Hi, I'm attempting to do a little AJAX-type stuff and I need a way to grab just the contents of a particular page without all the headers, sidebars
and
footers, but with the standard rendering (tags, plugins, etc) working.
Basically, if I have a page "Main.testpage" containing this: I am some [somelink>text].
I'd like to be able to make a javascript call to some url and get the rendered page: I am some <a href="somelink">text</a>.
(Notice there's no headers, menus, edit buttons, etc.)
I've been looking into the xwiki source. I was hoping there was something like a "justcontents" action (ie "http://sitename/xwiki/bin/justcontents/Main/testpage"), but there doesn't appear to be.
I found the xmlrpc interface, but there's a few issues to overcome, one of which is that I'd somehow have to get and store the username and password in the javascript (on the client side) to make the login token for the getPage() function.
If there is nothing simple built-in, and xmlrpc is the only way, is there a good way around the password issue? (or even how to get the password)?
Anyone try something similar? Am I going about this in the entirely wrong way?
Thanks, -Tom
-- Tom Kliethermes
-- You receive this message as a subscriber of the [email protected] mailing list. To unsubscribe: mailto:[email protected] For general help: mailto:[email protected]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
-- You receive this message as a subscriber of the [email protected] mailing list. To unsubscribe: mailto:[email protected] For general help: mailto:[email protected]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
participants (2)
-
Robin Fernandes -
Thomas Kliethermes