Author Topic: [Mod] bbcode Smileys  (Read 186559 times)

0 Members and 2 Guests are viewing this topic.

Offline tafferKakao

  • Newbie
  • *
  • Posts: 15
    • View Profile
    • Pixxor.de - Just Funpics
[Mod] bbcode Smileys
« on: March 12, 2005, 12:55:49 PM »
i created a little smilie mod, based on the phpbb standard smilies. a very little and easy to install mod ... but i hope you'll like and use it anyway ;)
for this mod i used 4images 1.7.1 ... but i don't think there would be problems with older versions!
-------------------------
ich hab einen kleinen smilie mod, auf basis der phpbb standard smilies erstellt. ein sehr kleiner und einfach zu installierender mod ... aber ich hoffe ihr werdet es trotzdem mögen ;)
für diesen mod habe ich 4 images 1.7.1 benutzt ... ich glaube aber nicht, das es probleme mit älteren versionen geben sollte!

attention! version 1.1 now available!
you should remove the changes of the old version in the following files, befor you "install" the new version! (just search for "Smilie Mod")
-------------------------
achtung! version 1.1 ab nun verfügbar!
vor der installation dieser version sollten die änderungen der alten version aus der folgenden dateien wieder entfernt werden! (einfach nach "Smilie Mod" suchen)


includes/functions.php



the following files will be changed (if you want to, you can make an backup of everything ... i don't think it's necessary)
-------------------------
folgende dateien werden verändert (wenn ihr wollt, könnt ihr natürlich backups machen ... ich halte es aber nicht für nötig)


includes/functions.php
templates/[your template]/styles.css
templates/[your template]/bbcode.html


the following files must be created
-------------------------
folgende dateien müssen erstellt werden

smilies ;)


step 1

create the following folder
-------------------------
erstellt folgenden ordner

templates/[your template]/smilies

download the smilies (mirror) and extract/save them in this folder
-------------------------
smilies herunterladen und in diesem ordner entpacken/speichern


step 2

open file:
-------------------------
datei öffnen:

includes/functions.php

step 2.1

find following code
-------------------------
folgenden code finden

Code: [Select]
function get_user_info($user_id = 0) {
add before
-------------------------
davor hinzufügen

Code: [Select]
// Smilie Mod
function show_smilies($text) {
    $search_smilie  = array(":)",":-)",":smile:",    ":D",":-D",":grin:",           ":(",":-(",":sad:", "8o","8-o",":shock",":eek:", ":?:",      ":?",":-?",":???:",               "8)","8-)",":cool:",  ":x",":-x",":mad:", ":p",":P",":-p",":-P",":razz:",     ":*",":-*",":oops:",           ":'(",":'-(",":cry:", ">:(",">:-(",":evil:",  ":roll:",   ";)",";-)",":wink:",  ":|",":-|",":neutral:",        ":o",":-o",              ">:)",">:-)",":twisted:",      ":lol:","LOL", ":!:",     ":idea:", ":arrow:", ":mrgreen:");
    $replace_smilie = array("smile","smile","smile", "biggrin","biggrin","biggrin", "sad","sad","sad",  "eek","eek","eek","eek",     "question", "confused","confused","confused", "cool","cool","cool", "mad","mad","mad",  "razz","razz","razz","razz","razz", "redface","redface","redface", "cry","cry","cry",    "evil", "evil", "evil", "rolleyes", "wink","wink","wink", "neutral","neutral","neutral", "surprised","surprised", "twisted","twisted","twisted", "lol","lol",     "exclaim", "idea",   "arrow",   "mrgreen");
  for($smile=0;$smile<count($search_smilie);$smile++){
    $text = str_replace($search_smilie[$smile],"<img src=\"".TEMPLATE_PATH."/smilies/icon_".$replace_smilie[$smile].".gif\">",$text);
  }

  return $text;
}
// End Smilie Mod


step 2.2

find following code
-------------------------
folgenden code finden

Code: [Select]
  $text = str_replace("\\'", "'", $text);
add after
-------------------------
after hinzufügen

Code: [Select]

  // Smilie Mod
  $text = show_smilies($text);
  // End Smilie Mod




step 3

open file:
-------------------------
datei öffnen:

templates/[your template]/styles.css

find last
-------------------------
letzes vorkommen finden

Code: [Select]
}
add after
-------------------------
danach hinzufügen

Code: [Select]

<!-- Smilie Mod -->
.smilie {
  background-color: transparent;
  background-repeat: no-repeat;
  border: none; cursor:hand;
}
<!-- End Smilie Mod -->


step 4

open file:
-------------------------
datei öffnen:

templates/[your template]/bbcode.html

find following code
-------------------------
folgenden code finden

Code: [Select]
function dolist(theform) {
  listtype = prompt(list_type_prompt, "");
  if ((listtype == "a") || (listtype == "1")) {
    thelist = "[list="+listtype+"]\n";
    listend = "[/list="+listtype+"] ";
  }
  else {
    thelist = "[list]\n";
    listend = "[/list] ";
  }
  listentry = "initial";
  while ((listentry != "") && (listentry != null)) {
    listentry = prompt(list_item_prompt, "");
    if ((listentry != "") && (listentry != null)) {
      thelist = thelist+"[*]"+listentry+"\n";
    }
  }
  theform.comment_text.value += thelist+listend;
  theform.comment_text.focus();
}

add after
-------------------------
danach hinzufügen

Code: [Select]
// Smilie Mod
function smilie(theform,smiliecode) {
  theform.comment_text.value += smiliecode;
  theform.comment_text.focus();
}
// End Smilie Mod

find following code
-------------------------
folgenden code finden

Code: [Select]
        <tr>
          <td class="row1">
            <input type="button" value=" B " onclick="bbcode(this.form,'B','')" name="button" class="button" />
            <input type="button" value=" I " onclick="bbcode(this.form,'I','')" name="button" class="button" />
            <input type="button" value=" U " onclick="bbcode(this.form,'U','')" name="button" class="button" />
            <input type="button" value="IMG" title="IMG" onclick="bbcode(this.form,'IMG','http://')" name="button" class="button" />
            <input type="button" value="http://" title="URL" onclick="namedlink(this.form,'URL')" name="button" class="button" />
            <input type="button" value="Code" title="CODE" onclick="bbcode(this.form,'code','')" name="button" class="button" />
            <input type="button" value="List" title="LIST" onclick="dolist(this.form)" name="button" class="button" />
          </td>
        </tr>

add after
-------------------------
danach hinzufügen

Code: [Select]

        <!-- Smilie Mod -->
        <tr>
          <td class="row2">
            <input type="button" value=" " onClick="smilie(this.form,' :D ')"        name="button" class="smilie" style="background-image: url({template_url}/smilies/icon_biggrin.gif); width: 15px;" />
            <input type="button" value=" " onClick="smilie(this.form,' :) ')"        name="button" class="smilie" style="background-image: url({template_url}/smilies/icon_smile.gif); width: 15px;" />
            <input type="button" value=" " onClick="smilie(this.form,' :( ')"        name="button" class="smilie" style="background-image: url({template_url}/smilies/icon_sad.gif); width: 15px;" />
            <input type="button" value=" " onClick="smilie(this.form,' :o ')"        name="button" class="smilie" style="background-image: url({template_url}/smilies/icon_surprised.gif); width: 15px;" />
            <input type="button" value=" " onClick="smilie(this.form,' 8o ')"        name="button" class="smilie" style="background-image: url({template_url}/smilies/icon_shock.gif); width: 15px;" />
            <input type="button" value=" " onClick="smilie(this.form,' :? ')"        name="button" class="smilie" style="background-image: url({template_url}/smilies/icon_confused.gif); width: 15px;" />
            <input type="button" value=" " onClick="smilie(this.form,' 8) ')"        name="button" class="smilie" style="background-image: url({template_url}/smilies/icon_cool.gif); width: 15px;" />
            <input type="button" value=" " onClick="smilie(this.form,' :lol: ')"     name="button" class="smilie" style="background-image: url({template_url}/smilies/icon_lol.gif); width: 15px;" />
            <input type="button" value=" " onClick="smilie(this.form,' :x ')"        name="button" class="smilie" style="background-image: url({template_url}/smilies/icon_mad.gif); width: 15px;" />
            <input type="button" value=" " onClick="smilie(this.form,' :p ')"        name="button" class="smilie" style="background-image: url({template_url}/smilies/icon_razz.gif); width: 15px;" />
            <input type="button" value=" " onClick="smilie(this.form,' :oops: ')"    name="button" class="smilie" style="background-image: url({template_url}/smilies/icon_redface.gif); width: 15px;" />
            <input type="button" value=" " onClick="smilie(this.form,' :cry: ')"     name="button" class="smilie" style="background-image: url({template_url}/smilies/icon_cry.gif); width: 15px;" />
            <input type="button" value=" " onClick="smilie(this.form,' :evil: ')"    name="button" class="smilie" style="background-image: url({template_url}/smilies/icon_evil.gif); width: 15px;" />
            <input type="button" value=" " onClick="smilie(this.form,' :twisted: ')" name="button" class="smilie" style="background-image: url({template_url}/smilies/icon_twisted.gif); width: 15px;" />
            <input type="button" value=" " onClick="smilie(this.form,' :roll: ')"    name="button" class="smilie" style="background-image: url({template_url}/smilies/icon_rolleyes.gif); width: 15px;" />
            <input type="button" value=" " onClick="smilie(this.form,' ;) ')"        name="button" class="smilie" style="background-image: url({template_url}/smilies/icon_wink.gif); width: 15px;" />
            <input type="button" value=" " onClick="smilie(this.form,' :| ')"        name="button" class="smilie" style="background-image: url({template_url}/smilies/icon_neutral.gif); width: 15px;" />
            <input type="button" value=" " onClick="smilie(this.form,' :!: ')"       name="button" class="smilie" style="background-image: url({template_url}/smilies/icon_exclaim.gif); width: 15px;" />
            <input type="button" value=" " onClick="smilie(this.form,' :?: ')"       name="button" class="smilie" style="background-image: url({template_url}/smilies/icon_question.gif); width: 15px;" />
            <input type="button" value=" " onClick="smilie(this.form,' :idea:' )"    name="button" class="smilie" style="background-image: url({template_url}/smilies/icon_idea.gif); width: 15px;" />
            <input type="button" value=" " onClick="smilie(this.form,' :arrow: ')"   name="button" class="smilie" style="background-image: url({template_url}/smilies/icon_arrow.gif); width: 15px;" />
          </td>
        </tr>
        <!-- End Smilie Mod -->


that's it! if you want so save your smilies in a different folder you just have to change the smilie path in functions.php - step 2.1. to add new smilies you have to put them in your smilie folder, add the smilie-code to the 2 arrays in functions.php and add some buttons in bbcode.html ... quite easy ;)
-------------------------
das war's! wenn ihr smilies in einem anderen verzeichnis benutzen wollt, müsst ihr nur den pfad functions.php - step 2.1 ändern. um neue smilies hinzuzufügen müsst ihr diese in euer smilie verzeichnis packen, den smiliecode bei den 2 arrays in functions.php hinzufügen und die buttons in bbcode.html einfügen ... recht einfach ;)
« Last Edit: March 16, 2006, 05:19:35 AM by V@no »

Offline erikito

  • Jr. Member
  • **
  • Posts: 71
    • View Profile
    • http://www.erikito.com/hotornot/
Re: [Mod] bbcode Smileys
« Reply #1 on: March 14, 2005, 06:26:11 PM »
Thx.  :wink: Very simple and clear.
grtz!
Visit my gallery if you want to see the hottest chicks on the net.
No spam, no crap, it's just for fun ;)

Thanks for the great script and your help guys!

http://www.erikito.com/

Offline tafferKakao

  • Newbie
  • *
  • Posts: 15
    • View Profile
    • Pixxor.de - Just Funpics
Re: [Mod] bbcode Smileys
« Reply #2 on: March 15, 2005, 01:45:03 PM »
thanks :D

Offline erikito

  • Jr. Member
  • **
  • Posts: 71
    • View Profile
    • http://www.erikito.com/hotornot/
Re: [Mod] bbcode Smileys
« Reply #3 on: March 22, 2005, 03:02:50 AM »
hey, I found a little problem with the smilies: The following code=>
Quote
: ? :
(without the spaces) doesn't show this :?: but this=>
Quote
:? :
(without the space)

I didn't notice anything else yet...

grtz!

Visit my gallery if you want to see the hottest chicks on the net.
No spam, no crap, it's just for fun ;)

Thanks for the great script and your help guys!

http://www.erikito.com/

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [Mod] bbcode Smileys
« Reply #4 on: March 22, 2005, 03:06:38 AM »
yeah, its a common problem with this method of parsing smilies...
in functions.php replace
Code: [Select]
    $search_smilie  = array(":)",":-)",":smile:",    ":D",":-D",":grin:",           ":(",":-(",":sad:", "8o","8-o",":shock",":eek:", ":?",":-?",":???:",               "8)","8-)",":cool:",  ":x",":-x",":mad:", ":p",":P",":-p",":-P",":razz:",     ":*",":-*",":oops:",           ":'(",":'-(",":cry:", ">:(",">:-(",":evil:",  ":roll:",   ";)",";-)",":wink:",  ":|",":-|",":neutral:",        ":o",":-o",              ">:)",">:-)",":twisted:",      ":lol:","LOL", ":!:",     ":?:",      ":idea:", ":arrow:", ":mrgreen:");with:
Code: [Select]
    $search_smilie  = array(":)",":-)",":smile:",    ":D",":-D",":grin:",           ":(",":-(",":sad:", "8o","8-o",":shock",":eek:", ":?:",":-?",":???:",               "8)","8-)",":cool:",  ":x",":-x",":mad:", ":p",":P",":-p",":-P",":razz:",     ":*",":-*",":oops:",           ":'(",":'-(",":cry:", ">:(",">:-(",":evil:",  ":roll:",   ";)",";-)",":wink:",  ":|",":-|",":neutral:",        ":o",":-o",              ">:)",">:-)",":twisted:",      ":lol:","LOL", ":!:",     ":?",      ":idea:", ":arrow:", ":mrgreen:");(note, I just exchanged possitions of ":?" and ":?:"
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline erikito

  • Jr. Member
  • **
  • Posts: 71
    • View Profile
    • http://www.erikito.com/hotornot/
Re: [Mod] bbcode Smileys
« Reply #5 on: March 22, 2005, 03:39:02 AM »
thx! :wink:
Visit my gallery if you want to see the hottest chicks on the net.
No spam, no crap, it's just for fun ;)

Thanks for the great script and your help guys!

http://www.erikito.com/

Offline tafferKakao

  • Newbie
  • *
  • Posts: 15
    • View Profile
    • Pixxor.de - Just Funpics
Re: [Mod] bbcode Smileys
« Reply #6 on: March 22, 2005, 07:16:28 AM »
thanks v@no ;)

Offline Flo2005

  • Full Member
  • ***
  • Posts: 237
  • Copy & Paste Profi :)
    • View Profile
    • snuup.de! - Bilder - Sounds - Videos - fun4FREE!
Re: [Mod] bbcode Smileys
« Reply #7 on: March 23, 2005, 05:44:00 PM »
I have changed the functions.php, style.css, bbcode.html and created smilies folder.

Now I get this

My 4img Vers. 1.7

Have somebody an idea what I did wrong?

Project offline

Offline Flo2005

  • Full Member
  • ***
  • Posts: 237
  • Copy & Paste Profi :)
    • View Profile
    • snuup.de! - Bilder - Sounds - Videos - fun4FREE!
Re: [Mod] bbcode Smileys
« Reply #8 on: March 23, 2005, 06:13:46 PM »
Sorry! I have forget to set a break in bbcode.html!

Great MOD  :D Now it Works with 1.7

Can I get this smilies in the discription too ?

Project offline

Offline tafferKakao

  • Newbie
  • *
  • Posts: 15
    • View Profile
    • Pixxor.de - Just Funpics
Re: [Mod] bbcode Smileys
« Reply #9 on: March 23, 2005, 06:58:07 PM »
it would be possible if you enable bbcode for the discription ... but then you could also add links to the description, underline text, etc. ... do you really want this?

and you should also add the bbcode-buttons (bbcode.html) to the upload-page!

umm ... i think, i'll do it ... i have holidays :p

Offline Flo2005

  • Full Member
  • ***
  • Posts: 237
  • Copy & Paste Profi :)
    • View Profile
    • snuup.de! - Bilder - Sounds - Videos - fun4FREE!
Re: [Mod] bbcode Smileys
« Reply #10 on: March 23, 2005, 07:44:03 PM »
What I mean is for example:



THX

Project offline

Offline tafferKakao

  • Newbie
  • *
  • Posts: 15
    • View Profile
    • Pixxor.de - Just Funpics
Re: [Mod] bbcode Smileys
« Reply #11 on: March 23, 2005, 08:24:22 PM »
i know what you mean ;)

but if i would allow bbcode in the description you could also add links, etc. to the description ... and i think you just want to have the smilies!

maybe i'll find an acceptable solution ... or do you allready have one? ;)

Offline Flo2005

  • Full Member
  • ***
  • Posts: 237
  • Copy & Paste Profi :)
    • View Profile
    • snuup.de! - Bilder - Sounds - Videos - fun4FREE!
Re: [Mod] bbcode Smileys
« Reply #12 on: March 23, 2005, 08:30:21 PM »
I haven´t enough time yet. When I find a way, I tell you in this Thread!

Cu by Flo

Project offline

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [Mod] bbcode Smileys
« Reply #13 on: March 24, 2005, 01:16:43 AM »
but if i would allow bbcode in the description you could also add links, etc. to the description ... and i think you just want to have the smilies!

maybe i'll find an acceptable solution ... or do you allready have one? ;)
I think u should move your smiles parsing script into a new function so u can call it anywhere in the code ;)
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline tafferKakao

  • Newbie
  • *
  • Posts: 15
    • View Profile
    • Pixxor.de - Just Funpics
Re: [Mod] bbcode Smileys
« Reply #14 on: March 24, 2005, 12:29:10 PM »
that should be the first step ... but therefore i have to rewrite the hole mod

anyway ... i'll do it ;)