« Movable Type Template Tweaks | Main | Chicklets »

Template Hacks

MT Hacks has brought out a new version of FormatList. This one is version 1.4 which has new icons and improved code. FormatList is a perl script that adds buttons to the entry templates to let you format bulleted and numbered lists.

Another great piece of code I added to the templates is Show/Hide Extended Entries. Normally when you click on the Read More link, you're redirected to the individual entry. This Javascript code shows you the rest of the entry on the same page. Show More » turns into « Hide More when the entry is expanded.

Try it...

The code is very easy to implement. Copy and paste the javascript code into the head section of your main index, date and category archive templates. ar1232 = ('varXYZ2' + (varA12));

<script language="javascript">
function showMore(varA1, varB1){
var123 = ('varXYZ' + (varA1));
varABC = ('varP' + (varA1));
if( document.getElementById ) {
if( document.getElementById(var123).style.display ) {
if( varB1 != 0 ) {
document.getElementById(var123).style.display = "block";
document.getElementById(varABC).style.display = "none";
} else { document.getElementById(var123).style.display = "none";
document.getElementById(varABC).style.display = "block"; }
} else { location.href = varB1;
return true; }
} else { location.href = varB1;
return true; }
}
</script>

The following code needs to replace the <MTEntryIfExtended> code.

<MTEntryIfExtended>
<span id="varP<$MTEntryID$>"><p><a href="<$MTEntryLink$>#<$MTEntryID pad="1"$>" onclick="showMore(<$MTEntryID$>,'<$MTEntryLink$># <$MTEntryID pad="1"$>');return false;">show more »</a></p><br /></span><div id="varXYZ<$MTEntryID$>" style="display: none"><p><$MTEntryMore$></p><p><a href="#<$MTEntryID pad="1"$>" onclick="showMore(<$MTEntryID$>,0);return
true;">« hide more</a></p></div>
</MTEntryIfExtended>

It's possible to set this up for expanding and collapsing comments too. Check out Scripty Goddess for the code.


TrackBack

TrackBack URL for this entry:
http://www.bestoday.com.au/cgi-bin/mt/mt-tb.cgi/1097

Leave a comment

Verification (needed to reduce spam):

September 2008

Sun Mon Tue Wed Thu Fri Sat
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

Subscribe

Enter your Email


Preview | Powered by FeedBlitz

Google AdSense

The Playground

DreamHost

GeoURL


Creative Commons License
This weblog is licensed under a Creative Commons License.