cogAutomatically send users to the page defined between the brackets
Developed by

Guillaume Lerouge

Rating
Rate!
0 Votes
LicenseGNU Lesser General Public License 2.1

Description

Once the snippet is added to a page, if you come back to that page in "view" mode you will be automatically sent to the page defined between the brackets.

Examples

Basic Redirects

  • Send the user to an external website
$response.sendRedirect("http://www.w3.org")
  • Send the user to another page on the wiki
$response.sendRedirect($xwiki.getURL('Some.Document'))
  • Send the user to another page on the wiki, in edit mode
$response.sendRedirect($xwiki.getURL('Some.Document', 'edit'))
  • Send the user directly to the edit mode of the page viewed
$response.sendRedirect($doc.getURL('edit'))

Advanced Redirects

  • Show the same page to the user but without applying the skin
$response.sendRedirect($doc.getURL('view', 'xpage=plain'))
  • Show the same page in wiki markup language but without applying the skin
$response.sendRedirect($doc.getURL('view', 'xpage=wml'))
  • Send to the same page but using a xml representation and without applying the skin
$response.sendRedirect($doc.getURL('view', 'xpage=xml'))
  • Send to a page to get a RSS Feed (need further explanation)
$response.sendRedirect($xwiki.getURL('Some.Document', 'view', 'xpage=rdf'))

XWiki 2.0 syntax

Don't forget to embrace the snippet between Velocity tags when you work in XWiki 2.0 syntax.

{{velocity}}
$response.sendRedirect($xwiki.getURL('Main.Home'))
{{/velocity}}

Prerequisites & Installation Instructions

Copy the code snippet to a page and save it.

Tags:
Created by Guillaume Lerouge on 2007/04/07 21:16
     

Get Connected