geeky

new hack for b2

BTW, the newest version of this hack could be found here new hack for b2 ๐Ÿ™‚ yay.. i stole this javascript display and hide function from movable type. it’s actually kinda easy to hack. if you want to use it or see how it works, click on “read more”.

first, you want to download this javascript file (right click and save target as). then open your b2template.functions.php in your b2-include directory and

find the line:
$output .= ” <a href=”$file?p=$id&more=1″>$more_link_text</a>”;

and replace it with:
$output .= ” <span id=”varP$id”><br /><a href=”$file#$id” onclick=”showMore($id,’$file#$id’);return false;”>read more ยป</a></span><div id=”varXYZ$id” style=”display: none”>$content[1]<br /><a href=”#$id” onclick=”showMore($id,0);return true;”>ยซ hide more</a></div>”;

save and reupload.

MAKE SURE you have <script language=”JavaScript” SRC=”http://yourdomain/dir/oops.js”></script&gt; in your <head> and </head> or else it won’t work.

then of course just like before, you write the “read more” entry with <!–more–> in b2.

that’s how it worked for me. i hope it works for you, too. if not, hmm oh well.

23 thoughts on “new hack for b2

  1. hey what is movable type? and i like ur site. mucho! um i was wondering if u could lend me the codes for when u click the link and everything shows up on the bottom! like ur opening a folder on the computer. i thought it was really cool. and i was also wondering if u could lend me the codes for at the top of ur site when u hover over the picture links those little text boxes show up. those were the coolest things! if u could please email them to me. and when i make my site i will give u the credit and link to ur site! thanx

  2. *waits for the sky to fall* ๐Ÿ˜‰ Dodo, I think it was only that one time, maybe while you were programming or whatnot. Tracy, MovableType is another blogging tool like b2 and Blogger. It does the same thing, but does it differently. ๐Ÿ™‚

  3. The hack looks great. I have a question, though. Did you do any prior modifications to the b2template.functions.php file? I’m asking because I couldn’t find that line in my file at all for some reason. Perhaps it’s the version (mine is 0.6pre5)? I’d appreciate any replies to my inquiries. Thanks in advance.

  4. hmm really? i don’t know. i’m using an older version. don’t even remember its actual number. i haven’t updated for so long. yes i hack a lot but i thought not that part hmm i don’t know. ecila found it?! what version are you using ecila?

    your code might not appear to be exactly the same. first find
    $content=explode(“<!–more–>”,$content);

    and then after that, find something like if ($more) { blah } else { blah }

    just replace the else part in the parentheses.

  5. opps…

    $output .= ‘ <a href=”‘ . $file.$querystring_start . ‘p’ . $querystring_equal . $id . $querystring_separator . ‘more’ . $querystring_equal . ‘1#more’ . $id . ‘”>’ . $more_link_text .’</a>’;

  6. Ergh.. I have a slight problem. The hack seems to be working, but I don’t know how to end it ! I know it starts with Do you end it with ? (I might want to have text after the read more thing… ๐Ÿ˜

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s