View previous topic :: View next topic |
Author |
Message |
annia
Joined: 09 Apr 2002 Posts: 18
|
Posted: Sun Sep 01, 2002 10:55 am Post subject: Auto convert your friend's names into links |
|
|
I duplicated and edited the smiley converter script a little bit so that it works now as a auto converter for your friend's names :) like if you type dodo after you posted the entry it will become dodo
Just copy and past the codes below into the intended *.php files (you find them all in the b2-include folder).
b2vars.php > the friends array.. customize it to your own friends:
Code: | $friendstrans = array(
'daynah' => 'girl.daynah.net',
'dodo' => 'www.pure-essence.net' ); |
b2vars.php > copy and paste:
Code: |
# generates friends' search & replace arrays
foreach($friendstrans as $friend => $url) {
$friendssearch[] = $friend;
$friend_masked = '';
for ($ii = 0; $ii < strlen($friend); $ii = $ii + 1) {
$friend_masked .= substr($friend, $ii, 1);
}
$b2_friendsreplace[] = "<a href='http://$url' target='_blank'>$friend_masked</a>";
} |
b2functions.php > copy and paste:
Code: | function convert_friends($content) {
global $friendssearch, $b2_friendsreplace;
$content = str_replace($friendssearch, $b2_friendsreplace, $content);
return ($content);
} |
b2template.functions.php:
Search for the function the_content and simply add the line $content=convert_friends($content); .. it should look like this:
Code: | function the_content($more_link_text="(more...)",$stripteaser="0",$more_file="") {
$content = get_the_content($more_link_text,$stripteaser,$more_file);
$content = convert_bbcode($content);
$content = convert_gmcode($content);
$content = convert_smilies($content);
$content=convert_friends($content);
$content = convert_chars($content,"html");
echo $content;
} |
Hope that helps :) |
|
Back to top |
|
 |
turtelina
Joined: 25 Jan 2002 Posts: 42 Location: Austria
|
Posted: Sun Sep 01, 2002 1:15 pm Post subject: Cool! |
|
|
Hey Annia,
That´s going to be so very useful! Thank you so very much for that hack.
Connie |
|
Back to top |
|
 |
Glutnix
Joined: 28 Mar 2002 Posts: 32 Location: New Zealand
|
Posted: Tue Sep 03, 2002 7:59 am Post subject: |
|
|
nice work! I've added Michel to my list _________________
|
|
Back to top |
|
 |
.Chris
Joined: 30 Apr 2002 Posts: 186 Location: Hawaii
|
Posted: Thu Sep 05, 2002 6:59 pm Post subject: |
|
|
O wowie and there's so many other things you can use it for.
Thanks! |
|
Back to top |
|
 |
Gadget Girl
Joined: 25 Jan 2002 Posts: 305 Location: Virginia
|
Posted: Tue Sep 24, 2002 4:02 pm Post subject: |
|
|
Thank you for this, way cool!
Sara |
|
Back to top |
|
 |
Cine
Joined: 22 Sep 2002 Posts: 22 Location: Lost
|
Posted: Tue Sep 24, 2002 7:01 pm Post subject: |
|
|
It looks so cool but I can't get it work! I can't really understand where to put in the codes too.. Help please? |
|
Back to top |
|
 |
Gadget Girl
Joined: 25 Jan 2002 Posts: 305 Location: Virginia
|
|
Back to top |
|
 |
Cine
Joined: 22 Sep 2002 Posts: 22 Location: Lost
|
Posted: Tue Sep 24, 2002 7:49 pm Post subject: |
|
|
It didn't Maybe you can make a zip? |
|
Back to top |
|
 |
Gadget Girl
Joined: 25 Jan 2002 Posts: 305 Location: Virginia
|
Posted: Tue Sep 24, 2002 9:16 pm Post subject: |
|
|
Make a zip of what?
If you read the code that I posted or that is in this thread, it does say where to put the code, exactly.
Sorry I couldn't help you. |
|
Back to top |
|
 |
Cine
Joined: 22 Sep 2002 Posts: 22 Location: Lost
|
Posted: Wed Sep 25, 2002 7:44 pm Post subject: |
|
|
Ish ok. I have tried to install it many times but it won't work.. I just wondered if you could zip the files used, when the code is pasted and send them to me? |
|
Back to top |
|
 |
.Chris
Joined: 30 Apr 2002 Posts: 186 Location: Hawaii
|
Posted: Wed Sep 25, 2002 9:09 pm Post subject: |
|
|
Cine
You need to edit the B2 files that already exist. If you don't understand her very clear and helpful tutorial, I suggest that you abandon trying to use this altogether. |
|
Back to top |
|
 |
Gadget Girl
Joined: 25 Jan 2002 Posts: 305 Location: Virginia
|
Posted: Thu Sep 26, 2002 4:59 pm Post subject: |
|
|
Ok, Cine...I will tell you what. I will charge you my flat tech rate of $15 USD an hour to do this for you. I will need the following in your email to me:
Your FTP info, domain name, passwords. If you are really sure you want to have someone do this for you, it will be done.
Thanks, Chris, I'm trying to get them up and running~
Sara |
|
Back to top |
|
 |
Cine
Joined: 22 Sep 2002 Posts: 22 Location: Lost
|
Posted: Fri Sep 27, 2002 6:05 pm Post subject: |
|
|
I don't think I want to pay you. Maybe you missunderstood me. I just asked if you could send me the b2vars, b2functions and b2template.functions file. If I have to pay you.. I won't. |
|
Back to top |
|
 |
.Chris
Joined: 30 Apr 2002 Posts: 186 Location: Hawaii
|
Posted: Fri Sep 27, 2002 6:51 pm Post subject: |
|
|
L O L |
|
Back to top |
|
 |
Gadget Girl
Joined: 25 Jan 2002 Posts: 305 Location: Virginia
|
Posted: Sun Sep 29, 2002 5:45 pm Post subject: |
|
|
Well, Cine, if I did all that work for you, I would want to be paid and the payment up front. Why not take a look at this thread and the tutorial again?
Chris |
|
Back to top |
|
 |
|