Difference between revisions of "Expandable.php"
m |
m |
||
Line 11: | Line 11: | ||
var content = document.getElementById("expandable-content-"+id); | var content = document.getElementById("expandable-content-"+id); | ||
if (content.style.display == "none") { | if (content.style.display == "none") { | ||
− | content.style.display = " | + | content.style.display = ""; |
} | } | ||
else { | else { | ||
Line 37: | Line 37: | ||
$article = preg_replace_callback( | $article = preg_replace_callback( | ||
'/<table class=["\']?expandable["\']? title=["\']?(.+?)["\']?\\s*>(.+?<\\/table\\s*?>)/s', | '/<table class=["\']?expandable["\']? title=["\']?(.+?)["\']?\\s*>(.+?<\\/table\\s*?>)/s', | ||
− | 'expandableCallback', | + | 'expandableCallback', |
$article | $article | ||
); | ); |
Revision as of 01:32, 2 October 2006
<? if ($GLOBALS['action'] == 'view') {
# Insert a JS function into the page to be called when show/hide links are clicked $article = preg_replace( '/(<\\/head\\s*>)/', '<script type="text/javascript">
function toggleExpandable(id) { var heading = document.getElementById("expandable-heading-"+id); var content = document.getElementById("expandable-content-"+id); if (content.style.display == "none") { content.style.display = ""; } else { content.style.display = "none"; } }
</script>$1',
$article );
# Callback function executed for rendering each expandable table function expandableCallback($matches) { $i = ++$GLOBALS["$title/tbl-count"];
return '
'.$matches[1].' |
<a href="javascript:toggleExpandable('.$i.')">[show ]</a> |