i need to make acode that in a forum u have smiles like this one :and if u dont want to press that smile button but to write this in the post box then it will become the smile like in here in vb u write
and it will become a smile auto.Code::)
tnx
| SitePoint Sponsor |
i need to make acode that in a forum u have smiles like this one :and if u dont want to press that smile button but to write this in the post box then it will become the smile like in here in vb u write
and it will become a smile auto.Code::)
tnx
are you building this forum from scratch?



use ob_start($output)
// make your page
then
$output = str_replace(": )", "image in here", $output);
ob_flush($output);
you should make ": )" into an array, and use erm, forgot..... its an array function, think its like array_key($array, ": )")
ye but could anybody write the full code and explanation for how to do that?
cuase i kinda rusty!
yes, unless there will be only one or two, you should use an array function. Tell me if the array doesn't work, in this case it should.
for $500Originally Posted by 50cent
![]()
actually do something like this:
and call the function with this:PHP Code:
$smiley = array(
'[ :) ]' => '<img src="smiley1.gif">',
'[ :( ]' => '<img src="smiley2.gif">',
'etc....'
);
PHP Code:$text = str_replace(array_keys($smiley), array_values($smiley), $text);
wow tnx alot!
no prob- is it working okay?
testing it know!
oopps
it show an error!
here is the error!
PHP Code:Warning: array_keys() [function.array-keys]: The first argument should be an array in e:\WebSites\ar.php on line 3
Warning: array_values() [function.array-values]: The argument should be an array in e:\WebSites\ar.php on line 3
PHP Warning: array_keys() [function.array-keys]: The first argument should be an array in e:\WebSites\ar.php on line 3
PHP Warning: array_values() [function.array-values]: The argument should be an array in e:\WebSites\ar.php on line 3
??
could you please show the entire code so far?
i made a file named ar.php and in the files where i need this function of the smiles i wrote the requrie ar.php thing !
<?php
$text = str_replace(array_keys($smiley), array_values($smiley), $text);
$smiley = array(
'[]' => '<img src="smiles/EmoPackv14_001.gif">',
'[ ): ]' => '<img src="smiles/EmoPackv14_002.gif">',
);
?>
oh lol I thought that you had the code that you weregoing to implement this into, what would happen is $text would be the current text, and you could put it to a pseudo-action by doing something like this:Originally Posted by 50cent
PHP Code:<?php
$smiley = array(
'[ (: ]' => '<img src="smiles/EmoPackv14_001.gif">',
'[ ): ]' => '<img src="smiles/EmoPackv14_002.gif">',
);
$text = "This is sample text right now :)";
$text = str_replace(array_keys($smiley), array_values($smiley), $text);
echo $text;
?>
no u didnt understood me and some guys building asimple system!
and in a page u have asmile column and u can press asmile picture and the code will be in the post where your writing somethig but u can also put the code of the smile and the smile picture will show up!
thats what we trying to do!
Bookmarks