| 1 |
$Id: EXAMPLES.txt,v 1.4 2005/02/21 14:10:09 axel Exp $
|
| 2 |
|
| 3 |
EXAMPLES OF SNIPPETS
|
| 4 |
|
| 5 |
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
| 6 |
!!! Due to API changes all examples are broken now !!!
|
| 7 |
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
| 8 |
|
| 9 |
|
| 10 |
Link to site pages: [l nid], [l page], [l nid|title], [l page|alt title]
|
| 11 |
|
| 12 |
<?php
|
| 13 |
$nid = $SNIPPET_PARAMS[0];
|
| 14 |
|
| 15 |
if (isset($SNIPPET_PARAMS[1])) {
|
| 16 |
$title = $SNIPPET_PARAMS[1];
|
| 17 |
}
|
| 18 |
if (is_numeric($nid)) {
|
| 19 |
print l($title ? $title : "node/$nid", "node/$nid");
|
| 20 |
}
|
| 21 |
else {
|
| 22 |
print l($title ? $title : "node/$nid", "$nid");
|
| 23 |
}
|
| 24 |
?>
|
| 25 |
|
| 26 |
====================================================================
|
| 27 |
|
| 28 |
LiveJournal userinfo: [ljuser|username]
|
| 29 |
|
| 30 |
<a href="http://www.livejournal.com/userinfo.bml?user=<?php print $SNIPPET_PARAMS[0] ?>" title="Search user at LiveJournal.com"><?php print $SNIPPET_PARAMS[0] ?>@LiveJournal</a>
|
| 31 |
|
| 32 |
====================================================================
|
| 33 |
|
| 34 |
Link to WikiPedia: [wikipedia|wikiword|lang]
|
| 35 |
Examples: [wikipedia|linukso|eo], [wikipedia|drupal]
|
| 36 |
|
| 37 |
<?php $lang = $SNIPPET_PARAMS[1] ? $SNIPPET_PARAMS[1] : 'en'; ?><a href="http://<?php print $lang ?>.wikipedia.org/wiki/<?php print $SNIPPET_PARAMS[0] ?>"><?php print $SNIPPET_PARAMS[0] ?></a>
|
| 38 |
|
| 39 |
====================================================================
|
| 40 |
|
| 41 |
Link to dkosopedia.com: [kos some Subject]
|
| 42 |
(overwrite functionality of dkosofilter.module)
|
| 43 |
|
| 44 |
<a href="http://www.dkosopedia.com/index.php/<?php print $SNIPPET_PARAMS[0] ?>><?php print $SNIPPET_PARAMS[0] ?></a>
|
| 45 |
|