Ik zag hier op photomatt.net een heel mooi scriptje dat ik graag voor mijn site wil gebruiken:
Maar hij werkt dus niet zoals op die pagina
Hij maakt er geen gestippelde link van en de beschrijving is de 'title' en niet wat er gedefineerd staat in acronymit <acronym title="MB">MB</acronym> bijvoorbeeld geeft als mouseover 'MB' en niet 'Megabyte'.
Weet iemand wat ik hier fout doe? Of kent iemand een beter acroniem script
code:
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
| <?php
function sortr_longer($first, $second) {
return (strlen($first) < strlen($second)) ? 1 : -1;
}
?>
<?php
function acronymit($text) {
$acronyms = array(
'XHTML' => 'eXtensible HyperText Markup Language',
'IIRC' => 'if I remember correctly',
'HDTV' => 'High Definition TeleVision',
'LGPL' => 'GNU Lesser General Public License',
'MSDN' => 'Microsoft Developer Network',
'WCAG' => 'Web Content Accessibility Guidelines',
'SOAP' => 'Simple Object Access Protocol',
'OPML' => 'Outline Processor Markup Language',
'MSIE' => 'Microsoft Internet Explorer',
'FOAF' => 'Friend of a Friend vocabulary',
'GFDL' => 'GNU Free Documentation License',
'XSLT' => 'eXtensible Stylesheet Language Transformation',
'HTML' => 'HyperText Markup Language',
'IHOP' => 'International House of Pancakes',
'IMAP' => 'Internet Message Access Protocol',
'RAID' => 'Redundant Array of Independent Disks',
'HPUG' => 'Houston Palm Users Group',
'VNC' => 'Virtual Network Computing',
'URL' => 'Uniform Resource Locator',
'W3C' => 'World Wide Web Consortium',
'MSN' => 'Microsoft Network',
'USB' => 'Universal Serial Bus',
'P2P' => 'Peer To Peer',
'PBS' => 'Public Broadcasting System',
'RSS' => 'Rich Site Summary',
'SIG' => 'Special Interest Group',
'RDF' => 'Resource Description Framework',
'AOL' => 'American Online',
'PHP' => 'PHP Hypertext Processor',
'SSN' => 'Social Security Number',
'JSP' => 'Java Server Pages',
'DOM' => 'Document Object Model',
'DTD' => 'Document Type Definition',
'DVD' => 'Digital Video Disc',
'DNS' => 'Domain Name System',
'CSS' => 'Cascading Style Sheets',
'CGI' => 'Common Gateway Interface',
'CMS' => 'Content Management System',
'FAQ' => 'Frequently Asked Questions',
'FSF' => 'Free Software Foundation',
'API' => 'Application Interface',
'PDF' => 'Portable Document Format',
'IIS' => 'Internet Infomation Server',
'XML' => 'eXtensible Markup Language',
'XSL' => 'eXtensible Stylesheet Language',
'GPL' => 'GNU General Public License',
'KDE' => 'K Desktop Environment',
'IE' => 'Internet Explorer',
'CD' => 'Compact Disk',
'GB' => 'Gigabyte',
'MB' => 'Megabyte',
'KB' => 'Kilobyte'
);
uksort($acronyms, 'sortr_longer'); // comment out if already sorted
foreach ($acronyms as $acronym => $definition) {
$text = preg_replace("#$acronym(?!</(ac|sp))#", "<acronym title=\"$definition\">$acronym</acronym>", $text, 1);
$text = preg_replace("#$acronym(?!</(ac|sp))#", "<span class='caps'>$acronym</span>", $text);
}
return $text;
}
function selectit($text) {
$lines = split("\n", $text);
foreach($lines as $line) {
unset($url); unset($currentarr); unset($urlarr);
preg_match('|href="([^"]*)"|', $line, $urls);
$url = $urls[1];
$current = $_SERVER["REQUEST_URI"];
if ($url == $current) {
$line = preg_replace('|<a[^>]+>([^>]*)</a>|', "<span class='Selected'>$1</span>", $line);
} else {
$currentarr = explode('/', $current);
$urlarr = explode('/', $url);
if ($currentarr[2] == $urlarr[2] && empty($urlarr[3])) {
$line = preg_replace('|">|', '" class="Selected">', $line);
}
}
$output .= $line."\n";
}
return $output;
}
?> |
Maar hij werkt dus niet zoals op die pagina
Hij maakt er geen gestippelde link van en de beschrijving is de 'title' en niet wat er gedefineerd staat in acronymit <acronym title="MB">MB</acronym> bijvoorbeeld geeft als mouseover 'MB' en niet 'Megabyte'.
Weet iemand wat ik hier fout doe? Of kent iemand een beter acroniem script
"Het leven is als een neus, je moet er uit halen wat er in zit ... "