Jump to content


GetLink


  • You cannot reply to this topic
4 replies to this topic

#1 ceaza

    Etomite Forum Newbie

  • Member
  • 27 posts

Posted 27 January 2005 - 09:25 PM

I have added a new snippet to the Snippet Library!

Snippet name: GetLink
Author: ceaza
Version: 1.0 (Final)
More info: View this snippet
Description:
Will create a link with the doc title on a page anywhere to a doc in the tree

Please feel free to comment on this snippet, suggest improvements, or simply praise my work! ;)

[This is an automatically created message]

#2 ceaza

    Etomite Forum Newbie

  • Member
  • 27 posts

Posted 27 January 2005 - 09:59 PM

I have updated this snippet in the Snippet Library!

[This is an automatically created message]

#3 bwoodsdesign

    Likes Etomite Forums!

  • Member
  • PipPip
  • 236 posts

Posted 16 August 2005 - 11:45 PM

Hi ceaza-

Any chance you have a page that would show an example of what the output of this looks like?

Thanks :)

#4 stp69

    Etomite Forum Newbie

  • Member
  • 41 posts

Posted 15 May 2009 - 09:33 PM

Hello,

I should like to assing a css-style to this snippet. I would call the snippets with:

[[GetLink?id=2&title=pagename&css=css-stylename]]

my idea was, i use the Code from the "title"

if (!$title){
$title = $result['pagetitle'];  
}

but i dont know, to replace the 'pagetitle'

if (!$css){
$css = $result['whatever'];  
}

and where i place the 'css' ??

$output = '<a href="[~'.$id.'~]" title="'.$title.'" class="'.$css.'">'.$title.'</a>';

The css-Style will define in the stylesheet.scc

sorry my bad english :blush: i hope you understand me

Edited by stp69, 15 May 2009 - 09:34 PM.


#5 Cris D.

    Loves Etomite Forums!

  • Developers
  • PipPipPipPip
  • 1,104 posts
  • Gender:Male

Posted 16 May 2009 - 11:22 AM

When you place a variable in the snippet call, it is automatically avaliable in the snippet.

Example
[!GetLink?id=2&title=Page Title&css=style1!]

In the snippet, if you have a variable used that was in the snippet call like this...
$output = "<a href='' title='$title' class='$css'>$title</a>";
 return $output;

This will return on the page

Quote

<a href='' title='Page Title' class='style1'>PageTitle</a>

There is no additional code required unless you want to start adding default values if one value is missing or other conditional changes and tweaks to the output.

This is where you use something like
if(!$css) $css='defaultStyle';

Then define your css in your css file as normal.

I hope I have understood your question.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users