Jump to content


Submitter

SUPPORT TOPIC File Information

  • Submitted: May 11 2007 05:43 PM
  • Last Updated: May 11 2007 05:43 PM
  • File Size: 1.16K
  • Views: 2665
  • Downloads: 236

Download LinkTo

- - - - -



This is my first public snippet, published about a year ago in this thread.

This snippet creates "external" links when the link is to a weblink instead of a document.

// --------------------
// Snippet: LinkTo
// --------------------
// Version: 1.0
// Date: 2006-05-30

// Original author: Gerrit-Jan Gommer (vw53a) 2006-05-30
// Thanks to the etomite community from whom I've borrowed parts for this snippet.
// This will be my first published snippet
//
// This snippet produces weblinks as external links
//

//
// Usage: [[LinkTo?where={id}]]
//

// Get the id
$id = (isset($where))? $where : "";
$docInfo = "";
$linkType = "";
$output = "";

// If id given then create link
if ($id != "") {

	// Get the document information
	$docInfo = $etomite->getPageInfo($id, 0, 'id,type,pagetitle,content');
	$linkType = str_replace('"', "'", trim($docInfo['type']));
	$linkDesc = str_replace('"', "'", trim($docInfo['pagetitle']));

	//is id a document a reference?
	if ($linkType == "reference") {

	  //build the external link
	  $output = "<a href=\"".$docInfo['content']."\" title=\"".$linkDesc."\" rel=\"external\">".$linkDesc."</a>";
	} else {

	  //build an internal link
	  $output = "<a href=\"[~".$id."~]\" title=\"".$linkDesc."\">".$linkDesc."</a>";
	}
}
return $output;






  • 248 Total Files
  • 19 Total Categories
  • 50 Total Authors
  • 131,658 Total Downloads
  • TripTracker Gallery Latest File
  • Dean Latest Submitter