Current location: Hot Scripts Forums » Programming Languages » PHP » smileys


smileys

Reply
  #1 (permalink)  
Old 12-22-05, 08:20 AM
mixx mixx is offline
Newbie Coder
 
Join Date: Dec 2005
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
smileys

hey, i'm stuck again with my guestbook!
i want to display smiley's, but they don't:

PHP Code:

 //show short comments

         
elseif (strlen($text)<$user_data[1])
            {
            echo 
nl2br($text);
    
          
$smileys = array(
          
':)' => '<img src="smileys/lol.gif" alt=":)" />',
foreach(
$smileys as $img => $imghtml)
{
    echo 
$imghtml;
}
             }
                         
             
        
?> 
i have totally no idea what i'm doing could use some biig help..
__________________
Still Learning
Reply With Quote
  #2 (permalink)  
Old 12-22-05, 12:35 PM
Richard's Avatar
Richard Richard is offline
Wannabe Coder
 
Join Date: Sep 2005
Location: Oxford, UK
Posts: 239
Thanks: 0
Thanked 0 Times in 0 Posts
You'll want to use the str_replace function to replace the smiley with the image, atm you're not replacing anything, heh.
PHP Code:

$newString str_replace(":)""<img src=\"smileys/lol.gif\" alt=\":)\" />"$oldString);

// New string is when the smilies are replaced, Old string is the previous posted string with ":)" 
Hope that helps.
Reply With Quote
  #3 (permalink)  
Old 12-22-05, 01:53 PM
mixx mixx is offline
Newbie Coder
 
Join Date: Dec 2005
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
the messages are saved in a text file, is that a problem?
i will try it when i get home
__________________
Still Learning
Reply With Quote
  #4 (permalink)  
Old 12-22-05, 02:59 PM
mixx mixx is offline
Newbie Coder
 
Join Date: Dec 2005
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
it worked thank you very much!
__________________
Still Learning
Reply With Quote
  #5 (permalink)  
Old 12-22-05, 05:16 PM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 8,075
Thanks: 11
Thanked 88 Times in 83 Posts
But I think this won't work if you're using a multi-line textfield, and there's a line-break.
Reply With Quote
  #6 (permalink)  
Old 12-23-05, 02:18 PM
mixx mixx is offline
Newbie Coder
 
Join Date: Dec 2005
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
it does check it: http://dakelder.t35.com/gastenboek/g...php/output.php
dont mind the layout and the design i'm just playing around for now.
__________________
Still Learning
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
smileys in a textfield mixx JavaScript 5 01-10-06 05:25 PM
Gradient In table cell dwoody CSS 9 08-25-04 08:14 PM


All times are GMT -5. The time now is 06:23 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.