 |
boardom b2 message board
|
View previous topic :: View next topic |
Author |
Message |
lilphil480
Joined: 30 Nov 2002 Posts: 19
|
Posted: Wed Oct 29, 2003 2:15 am Post subject: [HACK] b2 Quicklinks |
|
|
I have some friends that I link regulary, and it got annoying to have to type their links up all the time. I didn't want to use the auto linking hack because I don't link them every time I type their names and I have some friends without sites with the same names. So I made a hack that allows you to click a button and link that person in your post instantly. Using some code from b2evolution's smilie bar and b2's smilie array I made this hack.
I will not take responsibility for any errors you make installing this hack. Back up your files. If you believe that I made a mistake writing this, plase let me know.
Step one:
Open b2config.php
Find the follwing line in your b2config.php file: Quote: | $use_bbcode = 0; // use BBCode, like bold |
Make sure it is set to 1 or this will not work. Example: Quote: | $use_bbcode = 1; // use BBCode, like bold |
Step two:
paste the following code anywhere into your b2config.php file: Quote: | // ** QuickLinks **
$b2quicklinks = array(
'Name' => 'http://the.url.here',
);
|
You can add as many people as you want, just add another line with 'Name' => 'http://the.url.here', before the );.
Save and close b2config.php
Step three:
Open b2-include/b2edit.form.php
Find the following code: Quote: | <input type="checkbox" class="checkbox" name="post_autobr" value="1" <?php
if ($autobr)
echo " checked" ?> tabindex="7" id="autobr" /><label for="autobr"> Auto-BR (converts line-breaks into <br /> tags)</label><br />
<?php echo $form_pingback ?> |
BEFORE it, add: Quote: | <br>
<?php
foreach($b2quicklinks as $linkname => $linkurl)
{
print '<input type="button" class="quicktags" value="'.$linkname.'" style="font-weight:none; width: auto" onClick="bbinsert(document.post,\'\', \'[url='.$linkurl.']'.$linkname.'[/url]\')" /> '; // TODO: escape '
}
?>
<br> |
Save and close b2edit.form.php
Step four:
Open b2-include/b2quicktags.js
Find: Quote: | // swirlee's bblink hack, slightly corrected |
BEFORE it, add: Quote: | function bbinsert(formObj, strIns, strInsClose )
{ // fplanque: added function
theSelection = false;
if (document.selection)
{
formObj.content.focus();
theSelection = document.selection.createRange().text; // Get text selection
// Add tags around selection
document.selection.createRange().text = strIns + theSelection + strInsClose;
formObj.content.focus();
theSelection = false;
return;
}
formObj.content.value += strIns + strInsClose;
formObj.content.focus();
return;
} |
Save and close b2quicktags.js
This function was taken from b2evolution [link]
Congratulations, upload all your files and open your admin panel, under your post content box will be buttons with each name on them. Clicking the button will insert the link into your post!
There is one more optional step.
Step five (optional)
This step will make your links open in a new window.
Open b2-include/b2vars.php
Find the following code: Quote: | '<a href="$1">$1</a>', // URL
'<a href="$1" title="$2">$2</a>', |
And change it to: Quote: | '<a href="$1" target="_blank">$1</a>', // URL
'<a href="$1" title="$2" target="_blank">$2</a>', |
Save and upload.
Any questions can be posted here or e-mailed to [email protected]. |
|
Back to top |
|
 |
mtwib
Joined: 09 Aug 2003 Posts: 7
|
Posted: Sat Nov 01, 2003 7:16 pm Post subject: |
|
|
Just hacked it in, it' runs VERY smoothly!! Thanks so much  |
|
Back to top |
|
 |
lilphil480
Joined: 30 Nov 2002 Posts: 19
|
Posted: Tue Nov 04, 2003 6:59 am Post subject: |
|
|
Just so I know, was the readme pretty self-explanatory? |
|
Back to top |
|
 |
Mellissa
Joined: 17 Nov 2002 Posts: 28 Location: Malaysia
|
Posted: Tue Nov 04, 2003 11:25 am Post subject: |
|
|
Very useful hack
Thank you! |
|
Back to top |
|
 |
|| - DJ - ||
Joined: 10 Jan 2004 Posts: 1
|
Posted: Wed Mar 17, 2004 2:34 pm Post subject: |
|
|
i installed it - very easy to do so!
thanks lots  |
|
Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB 2 © 2001, 2002 phpBB Group
|