[geeklog-devel] New function for lib-common

Blaine Lang geeklog at langfamily.ca
Thu May 15 14:49:37 EDT 2003


Tony Bibbs" <tony at tonybibbs.com> wrote:

> Is a DB table really needed?  I think a section in a config file would be
best suited for this.
It's just a lot easier to update and manage a table then a config file. As
with good normalized database design, there may be a number of extra small
tables. We have some now with just 2 records. Thats ok - Don't have to
access to bother with them.

I imagine it could be a XML formated config file using a XML class to read
and update - but is that not more overhead then a simple SQL call?

Blaine
----- Original Message -----
From: "Tony Bibbs" <tony at tonybibbs.com>
To: <geeklog-devel at lists.geeklog.net>
Sent: Thursday, May 15, 2003 2:34 PM
Subject: Re: [geeklog-devel] New function for lib-common


> Is a DB table really needed?  I think a section in a config file would be
> best suited for this.  I'm just saying this from the ever growing DB bloat
> we have.  I"m fine either way but if you can figure out an easy way to
> support this via a config file that would be great.
>
> --Tony
>
>  On Tue, 13 May 2003,
> Blaine Lang wrote:
>
> > I've used emoticons in a few of my projects and I'm working on a new
plugin that also supports them. I've reworked the function that I'm now
pretty happy with. We also have had requests to add support for emoticons
and smilies in the core GL story and comment engine. Not really a key
requirement for business use but the basic ones are handy.
> >
> > Anyway, my new function uses a table for the mappings of emoticons to
images and will be easy to extend - just need to now create a admin module.
You can have multiple emoticons map to the same image as in :) and :-) to
the smile image.
> >
> > Any concerns in adding this function to CVS?
> > - need to update lib-databases
> > - add a new config parm $_CONF['SMILE_PATH']
> > - update the 1.3.8 updgrade SQL script
> >
> > Blaine
> >
> > The function is shown below
> > ---------------
> > /**
> > * Replace emoticons in string with formated HTML of smilies.
> > * Emoticon mapping to images are defined in a the table.
> > * This function will replace all the emoticons in the past string.
> > * @param   string  $text  The text
> > * @return    string  The text, possibly with emoticons replaced with the
HTML img tags for the smilie image.
> > */
> > function COM_replaceEmoticons( $text ) {
> >     global $_CONF, $_TABLES;
> >
> >     $arr_smilies = array();
> >     $sql = DB_query("SELECT code,smile_url from {$_TABLES['smilies']}");
> >     while ( list($key,$icon) = DB_fetchARRAY($sql)) {
> >         $arr_smilies[$key] = $icon;
> >     }
> >
> >     foreach ($arr_smilies as $key => $icon) {
> >         $text = str_replace($key,'<img src='.$_CONF['SMILE_PATH']. $icon
. ' BORDER="0">',$text);
> >     }
> >
> >     return $text;
> >
> > }
> >
> >
> >
>
> --
> Tony Bibbs          "I guess you have to remember that those who don't
> tony at tonybibbs.com  hunt or fish often see those of us who do as
>                     harmlessly strange and sort of amusing. When you
>                     think about it, that might be a fair assessment."
>                     --Unknown
>
>
> _______________________________________________
> geeklog-devel mailing list
> geeklog-devel at lists.geeklog.net
> http://lists.geeklog.net/listinfo/geeklog-devel




More information about the geeklog-devel mailing list