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> 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 Comments Leave a Comment

Miki [ Quote ]

I think it does, luvvie!

April 14th, 2003 at 10:47 pm
Miki [ Quote ]

test test… (got error message just after last commenting)

April 14th, 2003 at 10:48 pm
dodo [ Quote ]

test

April 14th, 2003 at 10:48 pm
dodo [ Quote ]

really? i didn’t hmm

April 14th, 2003 at 10:49 pm
tracy [ Quote ]

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

April 15th, 2003 at 12:24 am
Miki [ Quote ]

*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. :)

April 15th, 2003 at 1:19 am
Lele [ Quote ]

oooh very nice!!
It didn’t work in mozilla though:( But I just might use it anyways :P

April 15th, 2003 at 11:01 am
dodo [ Quote ]

lele, i did work on my mozilla. what mozilla are you using?

April 15th, 2003 at 12:42 pm
dodo [ Quote ]

tracy: the falling petals script is found here and the hover effect is found here

April 15th, 2003 at 1:39 pm
bunnywunny_ [ Quote ]

Whoa, cool script dodo. o_O!!!! Wow, I would really love to use this.. =D I’d have to install b2! T.T But if I go back, this script would be cool. =D =D

April 15th, 2003 at 7:08 pm
ecila [ Quote ]

oOoOoO me using it!! it’s sweeet ;) like it dodo!! hehehe thanks for the hack! no javascript error! w0ot! =DD

April 15th, 2003 at 7:09 pm
Emily [ Quote ]

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.

April 16th, 2003 at 4:41 am
dodo [ Quote ]

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.

April 16th, 2003 at 12:30 pm
ecila [ Quote ]

i THINK i’m using the latest one….

but yeaa, the line you told us to find, i couldn’t find, but i found what was closest… and it was the following

<br />
	$output .= ' <a href="'.$file.$querystring_start.'p'.$querystring_equal.$id.$querystring_separator.'more'.$querystring_equal.'1#more'.$id.'">'.$more_link_text.'</a>';<br />
April 16th, 2003 at 4:45 pm
ecila [ Quote ]

opps…

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

April 16th, 2003 at 4:46 pm
ecila [ Quote ]

wahh! hahaah i screwed it up XDD lol!

but yeaa.. just look for a line which begins with $output .=

and includes
‘.$more_link_text.’

=)

April 16th, 2003 at 4:47 pm
Emily [ Quote ]

Thanks for all the help. I got it all figured out. :)

April 16th, 2003 at 6:08 pm
evie [ Quote ]

wooot! I am using your hack now. thanks a lot! =D

April 22nd, 2003 at 4:02 am
Fiona [ Quote ]

cool ! I’ve used it now :)

April 30th, 2003 at 10:44 am
Lauren [ Quote ]

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… :|

August 26th, 2003 at 8:47 pm
dodo [ Quote ]

end with <!–endmore–>

August 27th, 2003 at 9:25 pm
dodo [ Quote ]

btw, the code in this post is not the most updated version, try this instead.

August 27th, 2003 at 9:28 pm
edie [ Quote ]

yemthe wachtwoord

October 17th, 2003 at 7:13 am

Leave a Comment Name, email and comment are required.
Email will never be displayed.

Leave a Comment
  1. :biggrin: :blank: :blush: :bored: :confused: :cool: :down: :evil: :frown: :grin: :grr: :laidback: :left: :mad: :right: :sad: :secret: :shock: :smile: :stress: :tongue: :up: :wink: :yawn: :cute: :dead: :film: :floppy: :glasses: :grumpy: :headphones: :heart: :lightbulb: :ouch: :tv: :upsidedown: :vodka: :yell: :yuck: :yummy: