July 19, 2005

Hide Your Email Address Using Javascript

Using javascript can allow you to hide your email address from spambots while displaying it for your readers. You can use this code (replacing the email address pieces, of course):

<script LANGUAGE="Javascript">
<!--
var user = "youremail";
var host = "address.com";
document.write(" <A HREF=""+ "mail" + "to:" + user + "@" + host + "">Email me</A>n");
//--> </script>

Posted by Hugo Fitch at 02:14 PM | TrackBack

July 15, 2005

Want Random Entry Excerpts on the Side?

Want to add random entry excerpts on the side of your blog to entice readers to dig deeper into your archives? Ben Huffine has crafted some code that'll do just that -- check out the box on the right side of this blog's main page.

You'll need to stick some CSS in your stylesheet -- all of they way at the bottom would be fine. Here's some that should suffice (it may be a bit clunky, but it works -- edit it however you like):

.archivedig {
font-size: 11px;
font-family: Arial, Helvetica, sans-serif;
line-height: 110%;
color: #9F998B;
text-align: left;
margin-bottom: 15px;
background-color: #FFFFFF;
padding:8px;
letter-spacing: none;
border: 1px solid #0052C2;
overflow: hidden;
}

.archivedig a, .archivedig a:link, .archivedig a:visited {
text-decoration: underline;
color: #0052C2;
overflow: hidden;
}

.archivedig a:active, .archivedig a:hover {
color: #999999;
overflow: hidden;
}

.archivedig h1, .archivedig h2, .archivedig h3 {
font-size: 10px;
font-family: Arial, Helvetica, sans-serif;
color: #8F8774;
border: none;
background-color: transparent;
margin-bottom: 4px;
text-align: left;
overflow: hidden;
}

.archivedig h1 a, .archivedig h1 a:link, .archivedig h1 a:visited, .archivedig h2 a, .archivedig h2 a:link, .archivedig h2 a:visited, .archivedig h3 a, .archivedig h3 a:link, .archivedig h3 a:visited {
text-decoration: none;
color: #0052C2;
overflow: hidden;
}

.archivedig h1 a, .archivedig h1 a:link, .archivedig h1 a:visited, .archivedig h2 a, .archivedig h2 a:link, .archivedig h2 a:visited, .archivedig h3 a, .archivedig h3 a:link, .archivedig h3 a:visited {
color: #999999;
overflow: hidden;
}

.archivedig b {
text-decoration: none;
overflow: hidden;
}

You'll also need to create a module. Go to to your template editing menu and scroll down to the bottom. Click "Create new template module." Name the new module ARCHIVEDIG. Now, put the code below in the Module Body:

<script language="javascript">
<!--
var i = 0;
var entries = new Array();

<MTEntries category="">
var year = '<$MTEntryDate format="%Y"$>';
var day = '<$MTEntryDate format="%j"$>';
var link = '<$MTEntryPermalink valid_html="yes"$>';
var title = '<$MTEntryTitle excerpt_words="5" encode_js="1" $>';
var body = '<$MTEntryExcerpt remove_html="1" encode_js="1" $>';
entries[i++] = new Array(year,day,link,title,body);

</MTEntries>

var index = Math.round(Math.random() * (<MTBlogEntryCount>-1));
var entry = entries[index];
year = entry[0];
day = entry[1];
link = entry[2];
title = entry[3];
body = entry[4];

document.write('<div class="archivedig">');

document.write('<h2>' + year + ' DAY ' + day + '</h2>');

document.write('<div style="padding-bottom:3px;"><a href="' + link + '"><b>' + title + '</b></a></div>');

document.write(body);
document.write('<br/>');
document.write('<div style="padding-top:3px;"><a href="' + link + '">Read More...</a></div>');
document.write('</div>');

//-->
</script>

Now, name this module STYLE-TOP and click save. Go to your Main Index and stick this somewhere in your template (wherever you want the module to be displayed): <$MTInclude module="STYLE-TOP"$>

Next, rebuild your entire blog and then check it out to make sure it's working. Enjoy!

Posted by Hugo Fitch at 05:52 PM | Comments (7) | TrackBack

\n