diff -urBN --exclude=.svn --exclude=.git --exclude=.DS_Store /Users/binneyd/Downloads/topcoll/format.php ./topcoll/format.php --- /your-topcoll/format.php 2010-11-08 08:14:00.000000000 +1000 +++ ./my-topcoll/format.php 2011-01-04 18:11:26.000000000 +1000 @@ -8,6 +8,7 @@ require_once($CFG->libdir.'/ajax/ajaxlib.php'); + require_once($CFG->dirroot.'/course/format/topcoll/lib/lib.php'); // For persistence of toggles. require_js(array('yui_yahoo', 'yui_cookie', 'yui_event')); @@ -237,7 +238,7 @@ $thissection->summary=''; echo ''.$topictext.' '.$currenttext.$section.' - '.$toggletext.''; } else { - echo ''.html_to_text($thissection->summary).' - '.$toggletext.''.$topictext.'
'.$currenttext.$section.''; + echo ''. get_title($thissection->summary) .' - '.$toggletext.''.$topictext.'
'.$currenttext.$section.''; // Comment out the above line and uncomment the line below if you do not want 'Topic x' displayed on the right hand side of the toggle. //echo ''.html_to_text($thissection->summary).' - '.$toggletext.''; } diff -urBN --exclude=.svn --exclude=.git --exclude=.DS_Store /Users/binneyd/Downloads/topcoll/lib/lib.php ./topcoll/lib/lib.php --- /your-topcoll/lib/lib.php 1970-01-01 10:00:00.000000000 +1000 +++ ./my-topcoll/lib/lib.php 2011-01-04 18:00:20.000000000 +1000 @@ -0,0 +1,21 @@ +loadHTML($html); + + $xpath = new DOMXPath($dom); + $tags = $xpath->query('//*[@class="toggle-title"]'); + + if ($tags->length > 0) { + $title = $tags->item(0)->textContent; + } else { + $title = html_to_text($html); + $title = substr($title, 0, 30) . "..."; + } + + return $title; + } + +?> \ No newline at end of file