Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Different Smilies for Different Themes
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #1
Different Smilies for Different Themes
This simple modification will allow you to have different smilies for different themes.
Note that, this, being an addition means that old smilies which are common across all themes will work fine.

Okay, firstly, open up /inc/class_parser.php,
Find:

PHP Code:
1
2
3
4
5
6
7
8
9
		global $cache;
		$this->smilies_cache = array();

		$smilies = $cache->read("smilies");
		if(is_array($smilies))
		{
			foreach($smilies as $sid => $smilie)
			{
				$this->smilies_cache[$smilie['find']] = "<img src=\"{$this->base_url}{$smilie['image']}\" style=\"vertical-align: middle;\" border=\"0\" alt=\"{$smilie['name']}\" title=\"{$smilie['name']}\" />";

Replace with:

PHP Code:
1
2
3
4
5
6
7
8
9
10
		global $cache, $theme;
		$this->smilies_cache = array();

		$smilies = $cache->read("smilies");
		if(is_array($smilies))
		{
			foreach($smilies as $sid => $smilie)
			{
				$smilie['image'] = str_replace('{theme}', $theme['imgdir'], $smilie['image']);
				$this->smilies_cache[$smilie['find']] = "<img src=\"{$this->base_url}{$smilie['image']}\" style=\"vertical-align: middle;\" border=\"0\" alt=\"{$smilie['name']}\" title=\"{$smilie['name']}\" />";


Also, open up misc.php,
Find: (2 occurances)

PHP Code:
$smilie['find'] = htmlspecialchars_uni($smilie['find']);

Add below: (2 occurances)

PHP Code:
$smilie['image'] = str_replace('{theme}', $theme['imgdir'], $smilie['image']);


Finally, open up inc/functions.php,
Find:

PHP Code:
$smiliecache[$smilie['find']] = $smilie['image'];

Replace with:

PHP Code:
$smiliecache[$smilie['find']] = str_replace('{theme}', $theme['imgdir'], $smilie['image']);


Now, upload smilies that you want to be different for each theme into your /images/<themedir>/smilies/ folder, for each theme.
Finally, go to your AdminCP -> Message Filters -> Smilie Manager and edit the Image Path of the smilies that you want to be different across all themes.
Just replace images with {theme} and update.  For example, the default Smile is:

Code:
images/smilies/smile.gif

If you want it to be different across themes, just change it to:

Code:
{theme}/smilies/smile.gif

(and don't forget to upload all the smilies to the appropriate location)


Edit: Updated


My Blog
(This post was last modified: 01-27-2008 10:46 PM by ZiNgA BuRgA.)
01-27-2008 08:01 PM
Find all posts by this user

« Next Oldest | Next Newest »

Messages In This Thread
Different Smilies for Different Themes - ZiNgA BuRgA - 01-27-2008 08:01 PM

 Standard Tools
Forum Jump: