T4VN is an online PHP Help community that provides PHP Tutorials, PHP Examples, PHP Scripts, PHP Support
    HOME  |  HOSTING COUPON  |  TEMPLATE  |  PHP SCRIPTS  |  LINK TO US  |  LINK  |  REGISTER | CONTACT
::: Member Login :::
 Username
 Password
 
Forgot your password ?
::: PHP Tutotal :::
  PHP Basic (7)
  PHP Advanced (4)
  PHP Database (2)
  Coding Step By Step (8)
  PHP and AJAX (0)
::: PHP Example :::
  Arrays (1)
  Code Highlighters (3)
  Database Functions (12)
  Date & Time (5)
  E-Mail (6)
  Forms (5)
  Guestbooks (1)
  Logging (2)
  Miscellaneous (10)
  Password Generators (3)
  Randomizers (3)
  String Manipulation (10)
  User Authentication (6)
::: Search On T4VN :::
::: T4VN Statistics :::
  PHP Scripts : 61
  PHP Example : 67
  PHP Tutorials : 21
  PHP News : 93
  Total Coupon : 36
  Other Tutorials :
  Member : 200
  Visitor Online : 2
  Today Visit: 216
  Total Visitor : 229493
  Most Online : 31
::: Sponsored Links :::

PR 4 For This Webpage
Home Today :

Emoticon Making

Author : xJonx

This is a code example on how to turn text into emoticons

PHP Example :

<?

$message 
str_replace":)""<img src='/emoticons/smile.gif'>"$message );
$message str_replace":(""<img src='emoticons/sad.gif'>"$message );
$message str_replace":P""<img src='emoticons/tongue.gif'>"$message );
$message str_replace":D""<img src='emoticons/biggrin.gif'>"$message );
$message str_replace":ninja:""<img src='emoticons/ninja.gif'>"$message );
$message str_replace":@""<img src='emoticons/angry.gif'>"$message );
$message str_replace":ohmy:""<img src='emoticons/ohmy.gif'>"$message );
$message str_replace";)""<img src='emoticons/wink.gif'>"$message );
$message str_replace":blink:""<img src='emoticons/blink.gif'>"$message );
$message str_replace"8)""<img src='emoticons/cool.gif'>"$message );
$message str_replace":dry:""<img src='emoticons/dry.gif'>"$message );
$message str_replace":huh:""<img src='emoticons/huh.gif'>"$message );
$message str_replace":rolleyes:""<img src='emoticons/rolleyes.gif'>"$message );
$message str_replace":haha:""<img src='emoticons/laugh.gif'>"$message );

?>



Usage Example:

PHP Example :


//Connect to the Mysql Database 

$connect = mysql_connect("host", "user", "pass") or die ('I cannot connect to the database because: ' . mysql_error()); 
mysql_select_db ("database_name");  
$result = mysql_query("SELECT * FROM table_name"); 
while($row = mysql_fetch_array( $result )) { 

//Turn the Text Into Smilies 

$message = str_replace( ":)", "<img src='/emoticons/smile.gif'>", $message ); 
$message = str_replace( ":(", "<img src='emoticons/sad.gif'>", $message ); 
$message = str_replace( ":P", "<img src='emoticons/tongue.gif'>", $message ); 
$message = str_replace( ":D", "<img src='emoticons/biggrin.gif'>", $message ); 
$message = str_replace( ":ninja:", "<img src='emoticons/ninja.gif'>", $message ); 
$message = str_replace( ":@", "<img src='emoticons/angry.gif'>", $message ); 
$message = str_replace( ":ohmy:", "<img src='emoticons/ohmy.gif'>", $message ); 
$message = str_replace( ";)", "<img src='emoticons/wink.gif'>", $message ); 
$message = str_replace( ":blink:", "<img src='emoticons/blink.gif'>", $message ); 
$message = str_replace( "8)", "<img src='emoticons/cool.gif'>", $message ); 
$message = str_replace( ":dry:", "<img src='emoticons/dry.gif'>", $message ); 
$message = str_replace( ":huh:", "<img src='emoticons/huh.gif'>", $message ); 
$message = str_replace( ":rolleyes:", "<img src='emoticons/rolleyes.gif'>", $message ); 
$message = str_replace( ":haha:", "<img src='emoticons/laugh.gif'>", $message ); 

//Echo out the message to turn the text into smilies 

echo "$message"; 

?> 





Other Example
Dynamic CSS PHP Script
Include layout
PHP File Security for Includes
Retrieving ID from Query String Non Register Globals
Custom colors
Detecting HTTPS


::: Resources :::
  Links Directory
  Programming 2 3
  Webmaster 2 3
  Web Design 2 3
  Web Hosting 2 3
  Other Links 2 3
  Asian ShowBiz News
  Teach Seo For You
::: New Templates :::




::: Other Tutorials :::
 Program Design

  Powered By T4VN.NET - Version 2.0 - CopyRight © T4VN.NET 2005-2007