1

Topic: Using smilies off-forums, using the parser

Hi everyone.

On my site, people can view their profile right on the site instead of on the forums. Instead of copying the parser file to the site directory, I just include it to the php file. The problem is, smilies are displayed relative to the forum directory. So, it uses "img/smilies/image.png" or whatever it really is. I tryed chmod-ing only the funtion, but that only threw errors. I read up on that and the chmod doesn't work for images anyway.

Is it possible to display the images some how without editing a whole lot of files, or copying the file?

Thanks, AG.

Re: Using smilies off-forums, using the parser

chmodding? hmm
Put PUN_ROOT before the paths

3

Re: Using smilies off-forums, using the parser

Oh, ok.

If anyone else cares, this is how I did it:

Open the parser file, go down to "// Convert a series of smilies to images", and find:

$text = preg_replace("#(?<=.\W|\W.|^\W)".preg_quote($smiley_text[$i], '#')."(?=.\W|\W.|\W$)#m", '$1<img src="img/smilies/'.$smiley_img[$i].'" width="15" height="15" alt="'.substr($smiley_img[$i], 0, strrpos($smiley_img[$i], '.')).'" />$2', $text);

And change it to:

$text = preg_replace("#(?<=.\W|\W.|^\W)".preg_quote($smiley_text[$i], '#')."(?=.\W|\W.|\W$)#m", '$1<img src="'.PUN_ROOT.'img/smilies/'.$smiley_img[$i].'" width="15" height="15" alt="'.substr($smiley_img[$i], 0, strrpos($smiley_img[$i], '.')).'" />$2', $text);

Thanks Smatys.

4 (edited by AlanCollier 2007-05-02 15:38)

Re: Using smilies off-forums, using the parser

AG, thanks for sharing the solution, I was wondering how to fix that.

Could this fairly be described as a bug worthy of a fix in PunBB generally? Smartys?
I guess it's only a problem when you're using the parser outside of its usual space.

--Alan

Re: Using smilies off-forums, using the parser

AlanCollier wrote:

AG, thanks for sharing the solution, I was wondering how to fix that.

Could this fairly be described as a bug worthy of a fix in PunBB generally? Smartys?
I guess it's only a problem when you're using the parser outside of its usual space.

--Alan

PunBB 1.3 will use absolute paths, so the issue will go away then: in the meantime, as you said, it's only an issue when you're modifying your forum and using its files outside of the forum directory.