Topic: Smilies

Encountered a "bug" when today when I coded on a CMS for pun. I use include/parser.php for parsing text and smilies don't work because of the file path is wrong.

I solved the problem by including $pun_root in the search path for the smilies in parser.php line 260.

I think this should be changed, all other files are included with $pun_root in the path name so why not smilies too? smile

"Real programmers are those that can sleep in front of terminals ... with their eyes opened."

"Real programmers don't work from 9 to 5. If any real programmers are around at 9am it's because they were up all night."

Re: Smilies

If anything, it should be base_url. Putting a local directory search path in front of the smilies will work only in some cases.

"Programming is like sex: one mistake and you have to support it for the rest of your life."

Re: Smilies

Hmm, the original filepatch is 'img/smilies/'.$smiley_img[$i] which is a local path. Can't see why $pun_root.'img/smilies/'.$smiley_img[$i] wouldn't work if $pun_root is for example ./ or punbb/.

"Real programmers are those that can sleep in front of terminals ... with their eyes opened."

"Real programmers don't work from 9 to 5. If any real programmers are around at 9am it's because they were up all night."

Re: Smilies

The original path is 'img/smilies/'.$smiley_img[$i], but that's not a filesystem path. It's a relative web path. $pun_root details for PHP where the PunBB scripts are located. It has nothing to with the address you use to navigate to the forums in your browser. I.e. if $pun_root was '/usr/local/apache/forums/', your code surely wouldn't work.

"Programming is like sex: one mistake and you have to support it for the rest of your life."

Re: Smilies

Hmm, that's a problem if an absolute filepath is used. Then $pun_root wasn't such nice sulotion I thought it was smile I'll see how I can solve my problem in an other way wink

"Real programmers are those that can sleep in front of terminals ... with their eyes opened."

"Real programmers don't work from 9 to 5. If any real programmers are around at 9am it's because they were up all night."

Re: Smilies

Did you try using $pun_options['o_base_url']?

"Programming is like sex: one mistake and you have to support it for the rest of your life."

Re: Smilies

Are you sure you didn't mean $pun_config['o_base_url']? smile I tried it now and it works excelent, thanks smile

"Real programmers are those that can sleep in front of terminals ... with their eyes opened."

"Real programmers don't work from 9 to 5. If any real programmers are around at 9am it's because they were up all night."

Re: Smilies

Whoops :)

"Programming is like sex: one mistake and you have to support it for the rest of your life."