Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Different Smilies for Different Themes
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,338
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
MyBB Us3r Offline
Junior Member
**
Posts: 19
Joined: Jan 2008
Post: #2
RE: Different Smilies for Different Themes
Thanks!

This comes in handy for when you have smilies that match only a certain theme, for example Christmas smilies are best used only in the Christmas theme and so on.
01-28-2008 06:17 AM
Find all posts by this user
carlyse_09 Offline
Junior Member
**
Posts: 3
Joined: Jan 2009
Post: #3
RE: Different Smilies for Different Themes
I will take note of the codes and other information for smilies.Later i will try it and share to my friends as well.
01-13-2009 07:13 PM
Find all posts by this user

« Next Oldest | Next Newest »

 Standard Tools
Forum Jump: