{REDIRECT(page=Foo#some_id)/}
does not work; the resulting URL is tiki-index.php?page=Foo#some_id&redirectpage=this_page
instead of tiki-index.php?page=Foo&redirectpage=this_page#some_id.
This patch provides a new parameter called "section" which can be set to the anchor id (not including the "#"). I decided to add this new parameter instead of better parsing of the "page" parameter to be consistent with the fragment syntax for internal links ( ((Foo|#bar))
- note how it's not ((Foo#bar))
)
--- wikiplugin_redirect.php.old 2009-04-29 07:02:08.000000000 -0500 +++ wikiplugin_redirect.php 2009-05-20 12:22:21.028250000 -0500 @@ -6,7 +6,7 @@ // @author damian aka damosoft 30 March 2004 function wikiplugin_redirect_help() { - return tra("Redirects you to another wiki page").":<br />{REDIRECT(page=pagename [,url=http://foobar])/}"; + return tra("Redirects you to another wiki page").":<br />{REDIRECT(page=pagename [,section=section_id] [,url=http://foobar])/}"; } function wikiplugin_redirect_info() { @@ -22,6 +22,11 @@ 'name' => tra('Page Name'), 'description' => tra('Wiki page name to redirect to.'), ), + 'section' => array( + 'required' => false, + 'name' => tra('Section/anchor id'), + 'description' => tra('Id of section/anchor within wiki page to redirect to (see id attribute of <a> elements in HTML source of wiki page).'), + ), 'url' => array( 'required' => false, 'name' => tra('ur l'), @@ -43,11 +48,15 @@ } else { /* SEO: Redirect with HTTP status 301 - Moved Permanently than default 302 - Found */ if (isset($page)) { - header("Location: tiki-index.php?page=$page&redirectpage=".$_REQUEST['page'], true, 301); + if (isset($section)) + $section = '#'.$section; + else + $section = ''; + header('Location: tiki-index.php?page='.urlencode($page).'&redirectpage='.$_REQUEST['page'].$section, true, 301); exit; } if (isset($ur l)) { - header("Location: $ur l"); + header("Location: $ur l", true, 301); exit; } }
To help developers solve the bug, we kindly request that you demonstrate your bug on a show2.tiki.org instance. To start, simply select a version and click on "Create show2.tiki.org instance". Once the instance is ready (in a minute or two), as indicated in the status window below, you can then access that instance, login (the initial admin username/password is "admin") and configure the Tiki to demonstrate your bug. Priority will be given to bugs that have been demonstrated on show2.tiki.org.
To help developers solve the bug, we kindly request that you demonstrate your bug on a show.tikiwiki.org instance. To start, simply select a version and click on "Create show.tikiwiki.org instance". Once the instance is ready (in a minute or two), as indicated in the status window below, you can then access that instance, login (the initial admin username/password is "admin") and configure the Tiki to demonstrate your bug. Priority will be given to bugs that have been demonstrated on show.tikiwiki.org.
filename | created | hits | comment | version | filetype | ||
---|---|---|---|---|---|---|---|
No attachments for this item |