Loading...
 

Allow redirect plugin to use fragment identifiers (section/anchor ids) (patch included)

Status
Open
Subject
Allow redirect plugin to use fragment identifiers (section/anchor ids) (patch included)
Version
1.9.x
2.x
3.x
Category
  • Feature request
  • Patch
Feature
Wiki Plugin (extends basic syntax)
Search engine optimization (SEO)
Submitted by
lbmaian
Lastmod by
Marc Laporte
Rating
(0)
Description
The redirect plugin currently lacks the ability to include fragment identifiers, e.g. {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.
Solution

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('url'),
@@ -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($url)) {
-			header("Location: $url");
+			header("Location: $url", true, 301);
 			exit;
 		}
 	}
Priority
25
Demonstrate Bug (Tiki 19+)
Please demonstrate your bug on show2.tikiwiki.org
 About show2.tikiwiki.org

To help developers solve the bug, we kindly request that you demonstrate your bug on a show2.tikiwiki.org instance. To start, simply select a version and click on "Create show2.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 show2.tikiwiki.org.

Version: Create show2.tikiwiki.org instance
Ticket ID
2516
Created
Wednesday 20 May, 2009 17:34:34 GMT-0000
by Unknown
LastModif
Sunday 07 June, 2009 16:15:30 GMT-0000

Attachments

 filenamecreatedhitscommentversionfiletype 
No attachments for this item


Keywords

The following is a list of keywords that should serve as hubs for navigation within the Tiki development and should correspond to documentation keywords.

Each feature in Tiki has a wiki page which regroups all the bugs, requests for enhancements, etc. It is somewhat a form of wiki-based project management. You can also express your interest in a feature by adding it to your profile. You can also try out the Dynamic filter.

Accessibility (WAI & 508)
Accounting
Administration
Ajax
Articles & Submissions
Backlinks
Banner
Batch
BigBlueButton audio/video/chat/screensharing
Blog
Bookmark
Browser Compatibility
Calendar
Category
Chat
Comment
Communication Center
Consistency
Contacts Address book
Contact us
Content template
Contribution
Cookie
Copyright
Credits
Custom Home (and Group Home Page)
Database MySQL - MyISAM
Database MySQL - InnoDB
Date and Time
Debugger Console
Diagram
Directory (of hyperlinks)
Documentation link from Tiki to doc.tiki.org (Help System)
Docs
DogFood
Draw -superseded by Diagram
Dynamic Content
Preferences
Dynamic Variable
External Authentication
FAQ
Featured links
Feeds (RSS)
File Gallery
Forum
Friendship Network (Community)
Gantt
Group
Groupmail
Help
History
Hotword
HTML Page
i18n (Multilingual, l10n, Babelfish)
Image Gallery
Import-Export
Install
Integrator
Interoperability
Inter-User Messages
InterTiki
jQuery
Kaltura video management
Karma
Live Support
Logs (system & action)
Lost edit protection
Mail-in
Map
Menu
Meta Tag
Missing features
Visual Mapping
Mobile
Mods
Modules
MultiTiki
MyTiki
Newsletter
Notepad
OS independence (Non-Linux, Windows/IIS, Mac, BSD)
Organic Groups (Self-managed Teams)
Packages
Payment
PDF
Performance Speed / Load / Compression / Cache
Permission
Poll
Profiles
Quiz
Rating
Realname
Report
Revision Approval
Scheduler
Score
Search engine optimization (SEO)
Search
Security
Semantic links
Share
Shopping Cart
Shoutbox
Site Identity
Slideshow
Smarty Template
Social Networking
Spam protection (Anti-bot CATPCHA)
Spellcheck
Spreadsheet
Staging and Approval
Stats
Survey
Syntax Highlighter (Codemirror)
Tablesorter
Tags
Task
Tell a Friend
Terms and Conditions
Theme
TikiTests
Timesheet
Token Access
Toolbar (Quicktags)
Tours
Trackers
TRIM
User Administration
User Files
User Menu
Watch
Webmail and Groupmail
WebServices
Wiki History, page rename, etc
Wiki plugins extends basic syntax
Wiki syntax text area, parser, etc
Wiki structure (book and table of content)
Workspace and perspectives
WYSIWTSN
WYSIWYCA
WYSIWYG
XMLRPC
XMPP




Useful Tools