/    Sign up×
Community /Pin to ProfileBookmark

Add smilies to a guestbook form

Hello

I am having a bit problem implementing the smilies to one free php guestbook I have found…
I have searched through the web and found lots of scripts but those that works easily doesn´t add an image,, just a text type.

So basically how do I add this script…
[url]http://www.netcode.net/tutorials/php_mysql/clickable_smilies.php[/url]

…to this guestbook, which is very customable…
[url]http://www.promosi-web.com/script/guestbook/[/url]


—-

The major problem I see here is that when replacing the text smilies to image smilies the action post need to be a php page with the required script for image replacement.. but on that guestbook the Action is already taken so that is there where I am stuck. I have no idea where $Self is referring at in the php page so I could add the replacement script there…

Sounds complicated but I am tired and had to type this question fast ?

thanks in advance

to post a comment
PHP

8 Comments(s)

Copy linkTweet thisAlerts:
@LiLcRaZyFuZzYJan 14.2006 — on [I]index.php[/I] [U][B]between[/B][/U] line [B]363 and 365[/B]:
[code=php]
#[...]
$tgl = date("F d, Y - h:i A"); # LINE 363

$vname = str_replace("<","&lt;",$vname); # LINE 365
$vname = str_replace(">","&gt;",$vname);
$vname = str_replace("~","-",$vname);
$vname = str_replace(""","&quot;",$vname);
$vcomment = str_replace("<","&lt;",$vcomment);
$vcomment = str_replace(">","&gt;",$vcomment);
$vcomment = str_replace("|","",$vcomment);
$vcomment = str_replace(""","&quot;",$vcomment);
$vurl = str_replace("<","",$vurl);
$vurl = str_replace(">","",$vurl);
$vurl = str_replace("|","",$vurl);
$vemail = str_replace("<","",$vemail);
$vemail = str_replace(">","",$vemail);
#[...]
[/code]

add:

[code=php]
# line 363
#
$vcomment = str_replace(":)", "<img src="smiling.gif" alt=":)">", $vcomment);
$vcomment = str_replace(":(", "<img src="sad.gif" alt=":(">", $vcomment);
# and so on..
# line 365
[/code]
Copy linkTweet thisAlerts:
@SiddanauthorJan 15.2006 — Hooray it works! ?

Alltho I obviously had to disable some of the replacements, cus it replacet /" to &quot; and such which screwed up the "img src" path

At least I understood That much ?

Thanks LiL
Copy linkTweet thisAlerts:
@LiLcRaZyFuZzYJan 15.2006 — 

yes sorry, i got something wrong with the order..did you fix it?
--


actually you simply have to add the whole smily stuff after that line
[code=php]
$vemail = str_replace(">","",$vemail);
[/code]


so it won't replace "<" with &lt; etc..(special characters with their entities)
Copy linkTweet thisAlerts:
@SiddanauthorJan 15.2006 — oooh, didn´t know the order actually had any difference with the character replacements. So I just put the smilies at the end.. after the last replacement and it seems to work superbly. Good so I don´t have to disable some single character replacements ...

thanks again ?
Copy linkTweet thisAlerts:
@LiLcRaZyFuZzYJan 16.2006 — yes the order does matter, because after the smilie replacement, [I]'?'[/I] will appear as [I]'<img src="smilie.gif" alt="?">'[/I], which contains the characters "<" and ">"

and if you run the function that changes those characters in their entities, the html image tag will appear on screen (instead of displaying the image)

in the source code it would look like:

<i>
</i>&amp;lt;img src=&amp;quot;smilie.gif&amp;quot; alt&amp;quot;:)&amp;quot;&amp;gt;
Copy linkTweet thisAlerts:
@SiddanauthorJan 17.2006 — I remember I had something else to ask regarding the date language on that guestbook.

I plan to add an english site also but now I have the site in swedish so how would I do to change the date language?

This is the code where i can find that has something to do with it

$idx = date("YmdHis");

$tgl = date("F d, Y - h:i A");

The month would be in swedish with a 24 hour time format


edit: ok, forgot google was my friend so I found the a table for different time formats... but not how to change the language
Copy linkTweet thisAlerts:
@LiLcRaZyFuZzYJan 17.2006 — using "locale", google it, or search on the forum

there is also something about it in the php manual
Copy linkTweet thisAlerts:
@SiddanauthorJan 17.2006 — yes, but not sure where and how to add,, adding it just like ()locale won´t do much i suppose
×

Success!

Help @Siddan spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...