tutorialtastic

BellaBook3.1,3.2: Implementing Smilies

Original tutorial courtesy of Bubs :)

BellaBook3.1

Open config.php in a text editor (i.e. Notepad). Scroll to the last line of the file. Before the ?>, paste the following code:
function convertSmiles($message) {
   // You can change "smilies/" to the path of a different directory if you like
   $path_to_smilies = "smilies/";

   $smilies = array(
   // You can edit what's in between the single quotes
   // The first set of single quotes contains the text to be converted
   // to the filename in the second set of single quotes

      ' :)'      => 'smile.gif',
      ' :D'      => 'biggrin.gif',
      ' :('      => 'sad.gif',
      ' :P'      => 'tongue.gif',
      ' :|'      => 'blank.gif',
      ' :o'      => 'shocked.gif',
      ' ;)'      => 'wink.gif',
      ' :?'      => 'confused.gif',
      ' 8|'      => 'eek.gif',
      ' :Z'      => 'mad.gif',
      ' :/'      => 'argh.gif'

   // DO NOT EDIT BELOW THIS LINE
   );
   foreach ($smilies as $key => $value) {
      $message = str_replace($key, "<img src='".$path_to_smilies.$value."' alt='$key' title='$key' />", $message);
   }
   return $message;
}

Save config.php. Open your BellaBook's index.php and find the following line:
$thiscontent = linebreaker($content[5]);
Paste the following code immediately after the previous line:
// Convert Smiles
$thiscontent = convertSmiles($thiscontent);

Save index.php and upload it along with config.php. Download some free smilies, unzip them and upload them to a folder called smilies in your guestbook directory.

BellaBook3.2

Open config.php in a text editor (i.e. Notepad). Scroll to the last line of the file. Before the ?>, paste the following code:
function convertSmiles($message) {
   // You can change "smilies/" to the path of a different directory if you like
   $path_to_smilies = "smilies/";

   $smilies = array(
   // You can edit what's in between the single quotes
   // The first set of single quotes contains the text to be converted
   // to the filename in the second set of single quotes

      ' :)'      => 'smile.gif',
      ' :D'      => 'biggrin.gif',
      ' :('      => 'sad.gif',
      ' :P'      => 'tongue.gif',
      ' :|'      => 'blank.gif',
      ' :o'      => 'shocked.gif',
      ' ;)'      => 'wink.gif',
      ' :?'      => 'confused.gif',
      ' 8|'      => 'eek.gif',
      ' :Z'      => 'mad.gif',
      ' :/'      => 'argh.gif'

   // DO NOT EDIT BELOW THIS LINE
   );
   foreach ($smilies as $key => $value) {
      $message = str_replace($key, "<img src='".$path_to_smilies.$value."' alt='$key' title='$key' />", $message);
   }
   return $message;
}

Save config.php. Open your BellaBook's index.php and find the following line:
$thiscontent = linebreaker($message);
Replace that code with this line:
$thiscontent = convertSmiles(linebreaker($message));

Save index.php and upload it along with config.php. Download some free smilies, unzip them and upload them to a folder called smilies in your guestbook directory.

Tags: bellabook, script-modding,
Last Updated On: 18th March 06 by Jem
Bookmark At: StumbleUpon, Digg

tutorialtastic — ultimately better than pixelfx
Copyright © Jem Turner 2003-08. (About | Disclaimer | Link In)