-
Notifications
You must be signed in to change notification settings - Fork 0
/
LTX.php
67 lines (47 loc) · 1.57 KB
/
LTX.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<?php
/*
LTX (Link Tags Extended)
Version: 0.9
Author: Mac Conin - http://conin.de
Other Contributors:
Based on an idea of Greg Smart http://www.gregorysmart.com
and Craig McCoy http://www.captaincodemonkey.com/blog/
Description: generates SEO optimized quick-links
MODx Versions:
Revolution - All versions. But not tested
Installation:
Create a new Snippet and name it LTX
Copy the content of this file into the empty snippet.
Parameters:
[[LTX? &id=`1` ]]
generates: <a href="/" title="longtitle-of-doc" alt="pagetitle-of-doc">menutitle-of-doc</a>
[[LTX? &id=`1`
&title=`this way`
&alt=`follow this link`
&link=`readmore`
&class=`css-class`
&follow=`nofollow`]]
Version History:
0.9 first version
*/
/**********Variables***********/
$doc = $modx->getObject('modResource', $id);
if (!($doc instanceof modResource)) { return 'doc not found'; }
$published = $doc->get('published');
if ($published == 0) { return 'doc not yet published'; }
$output = '';
/**longtitle --> title**/
if ($title == '') $title = $doc->get('longtitle');
/**pagetitle --> alt**/
if ($alt == '') $alt = $doc->get('pagetitle');
/**menutitle --> link**/
if ($link == '') $link = $doc->get('menutitle');
/**css class**/
if ($class != '')
$class="class=\"".$class."\"";
/**should I folow oder go ;) **/
if ($follow != '')
$follow=" rel=\"".$follow."\"";
if(!empty($doc))
$output = "<a ".$class.$follow." alt=\"".$alt."\" title=\"".$title."\" href=\"".$modx->makeUrl($id, '', '', 'full')."\">".$link."</a>";
return $output;