What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » php smilie code check

Pages: (3): « First « 1 [ 2 ] 3 » Last »
php smilie code check
Author: Message:
Veggie
Full Member
***

Avatar

Posts: 415
Reputation: 21
37 / Male / Flag
Joined: Sep 2004
RE: php smilie code check
$text = "hello test :o";

then string replace

then
echo $text;
12-24-2005 04:54 PM
Profile E-Mail PM Web Find Quote Report
stoshrocket
Senior Member
****

Avatar
formerly methos

Posts: 748
Reputation: 31
33 / Male / Flag
Joined: Aug 2005
O.P. RE: php smilie code check
quote:
Originally posted by Veggie
$text = "hello test :o";

then string replace

then
echo $text;

ok, im well and truly baffled. i think it would be quicker with the <img src=".."> code... lol, thanks anyway!

This post was edited on 12-24-2005 at 05:06 PM by stoshrocket.
formerly methos
12-24-2005 05:06 PM
Profile PM Web Find Quote Report
Plik
Veteran Member
*****

Avatar

Posts: 1489
Reputation: 46
34 / Male / –
Joined: Jun 2004
RE: php smilie code check
quote:
Originally posted by Methos2
quote:
Originally posted by Veggie
$text = "hello test :o";

then string replace

then
echo $text;

ok, im well and truly baffled. i think it would be quicker with the <img src=".."> code... lol, thanks anyway!

What he wants is for you to set $text to "hello test :[b][/b]o" then perform the replace and then echo $text and tell us what it outputs.
Also could you post your complete $smiley_list and $replacement_list, arrays? (the two limes that start with $smiley_list = Array, and $replacement_list = Array)
12-24-2005 05:11 PM
Profile PM Find Quote Report
hmaster
Senior Member
****

Avatar

Posts: 716
Reputation: 24
33 / Male / Flag
Joined: Nov 2004
RE: php smilie code check
He means that the code will only work if you put the text in the $text variable.

This is my news post 0:) :D :)

code:
<?php

$text = "This is my news post  0:) :D :)[";

$smiley_list = array(":)", "0:)", ":D", the rest of the smilies);
$replacement_list = array('<img alt="smiley" src="smilies/grin.gif" />', '<img alt="smiley" src="smilies/angel.gif" />', '<img alt="smiley" src="smilies/biggrin.gif" />', The rest of the replacements here, using this format: '<img alt="alttext" src="location' />");

$text = str_replace($smiley_list, $replacement_list, $text);

echo $text;
?>

lol @Madman ;)

This post was edited on 12-24-2005 at 05:18 PM by hmaster.
[Image: sig.png]
12-24-2005 05:12 PM
Profile PM Web Find Quote Report
stoshrocket
Senior Member
****

Avatar
formerly methos

Posts: 748
Reputation: 31
33 / Male / Flag
Joined: Aug 2005
O.P. RE: php smilie code check
quote:
Originally posted by hmaster
He means that the code will only work if you put the text in the $text variable.

This is my news post 0:) :D :)

code:
<?php

$text = "This is my news post  0:) :D :)[";

$smiley_list = array(":)", "0:)", ":D", the rest of the smilies);
$replacement_list = array('<img alt="smiley" src="smilies/grin.gif" />', '<img alt="smiley" src="smilies/angel.gif" />', '<img alt="smiley" src="smilies/biggrin.gif" />', The rest of the replacements here, using this format: '<img alt="alttext" src="location' />");

$text = str_replace($smiley_list, $replacement_list, $text);

echo $text;
?>



but having to to do this throughout the code deifes the object of a 'shortcut' such as :), unless i have missed something here it would be alot simpler and quicker to just use the html tag <img> wouldnt it.... :undecided:

This post was edited on 12-24-2005 at 07:59 PM by stoshrocket.
formerly methos
12-24-2005 07:58 PM
Profile PM Web Find Quote Report
hmaster
Senior Member
****

Avatar

Posts: 716
Reputation: 24
33 / Male / Flag
Joined: Nov 2004
RE: php smilie code check
In your case yes. But it depends how you do it.
Something like WordPress does not rely on FTP to add new blog/news posts. It has a form, which then can be easier to add scripts too.
[Image: sig.png]
12-24-2005 08:03 PM
Profile PM Web Find Quote Report
Plik
Veteran Member
*****

Avatar

Posts: 1489
Reputation: 46
34 / Male / –
Joined: Jun 2004
RE: php smilie code check
quote:
Originally posted by Methos2
quote:
Originally posted by hmaster
He means that the code will only work if you put the text in the $text variable.

This is my news post 0:) :D :)

code:
<?php

$text = "This is my news post  0:) :D :)[";

$smiley_list = array(":)", "0:)", ":D", the rest of the smilies);
$replacement_list = array('<img alt="smiley" src="smilies/grin.gif" />', '<img alt="smiley" src="smilies/angel.gif" />', '<img alt="smiley" src="smilies/biggrin.gif" />', The rest of the replacements here, using this format: '<img alt="alttext" src="location' />");

$text = str_replace($smiley_list, $replacement_list, $text);

echo $text;
?>



but having to to do this throughout the code deifes the object of a 'shortcut' such as :), unless i have missed something here it would be alot simpler and quicker to just use the html tag <img> wouldnt it.... :undecided:

The whole point in that is to test that you are setting the $text variable correctly and that you are executing the function correctly, you wont have to do that for the code once whe can make sure that it is working correctly.
also:
quote:
Originally posted by Madman
could you post your complete $smiley_list and $replacement_list, arrays? (the two limes that start with $smiley_list = Array, and $replacement_list = Array)
12-24-2005 08:15 PM
Profile PM Find Quote Report
stoshrocket
Senior Member
****

Avatar
formerly methos

Posts: 748
Reputation: 31
33 / Male / Flag
Joined: Aug 2005
O.P. RE: php smilie code check
ok, it shows as it should, it replaces the smilies with the appropriate pics, and as for the code, ill just go and fetch it.....
this is the whole php code that is in the document::
code:
<?php
$smiley_list = array(":)", "0:)", ":D", ":S", "B)", ":'(", ":$",
":|", "8-)", "^o)", ":o", ":P", ";)", ":refuck:", ">(", "='(",
"=D", "O.o", "=(", "=)", "=P", "=/", );
$replacement_list = array(
'<img alt="smilie" src="smilies/grin.gif" />',
'<img alt="smilie" src="smilies/angel.gif" />',
'<img alt="smilie" src="smilies/biggrin.gif" />',
'<img alt="smilie" src="smilies/confuzzled.gif" />',
'<img alt="smilie" src="smilies/cool.gif" />',
'<img alt="smilie" src="smilies/cry.gif" />',
'<img alt="smilie" src="smilies/embarrassed.gif" />',
'<img alt="smilie" src="smilies/notamused.gif" />',
'<img alt="smilie" src="smilies/rolleyes.gif" />',
'<img alt="smilie" src="smilies/sarcastic.gif" />',
'<img alt="smilie" src="smilies/shock.gif" />',
'<img alt="smilie" src="smilies/tongue.gif" />',
'<img alt="smilie" src="smilies/wink.gif" />',
'<img alt="smilie" src="smilies/refuck.gif" />',
'<img alt="smilie" src="smilies/bangry.gif" />',
'<img alt="smilie" src="smilies/bcry.gif" />',
'<img alt="smilie" src="smilies/blaugh.gif" />',
'<img alt="smilie" src="smilies/bwassat.gif" />',
'<img alt="smilie" src="smilies/bsad.gif" />',
'<img alt="smilie" src="smilies/bsmile.gif" />',
'<img alt="smilie" src="smilies/btongue.gif" />',
'<img alt="smilie" src="smilies/bwink.gif" />',
);
$text = str_replace($smiley_list, $replacement_list, $text);
?>


This post was edited on 12-24-2005 at 08:19 PM by stoshrocket.
formerly methos
12-24-2005 08:18 PM
Profile PM Web Find Quote Report
Plik
Veteran Member
*****

Avatar

Posts: 1489
Reputation: 46
34 / Male / –
Joined: Jun 2004
RE: php smilie code check
quote:
Originally posted by Methos2
ok, it shows as it should, it replaces the smilies with the appropriate pics, and as for the code, ill just go and fetch it.....
this is the whole php code that is in the document:
Then if it works as it should if you set the the $text variable in the script then the problem is caused by how you set the $text variable to your input.
12-24-2005 08:29 PM
Profile PM Find Quote Report
stoshrocket
Senior Member
****

Avatar
formerly methos

Posts: 748
Reputation: 31
33 / Male / Flag
Joined: Aug 2005
O.P. RE: php smilie code check
quote:
Originally posted by Madman
quote:
Originally posted by Methos2
ok, it shows as it should, it replaces the smilies with the appropriate pics, and as for the code, ill just go and fetch it.....
this is the whole php code that is in the document:
Then if it works as it should if you set the the $text variable in the script then the problem is caused by how you set the $text variable to your input.

its not a case of it not working.... its just a case of that...

quote:
Originally posted by Methos2
but having to to do this throughout the code deifes the object of a 'shortcut' such as :), unless i have missed something here it would be alot simpler and quicker to just use the html tag <img> wouldnt it....
formerly methos
12-24-2005 08:33 PM
Profile PM Web Find Quote Report
Pages: (3): « First « 1 [ 2 ] 3 » Last »
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On