Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-02-16 00:38:04

Ji31
Member
Registered: 2005-08-24
Posts: 103

Inserting php - replacing of smilies?

I want to insert this code in one place of my site. This should replace the text emoticons for images.
But it does nothing.
What I have wrong?

<txp:php>
global $thisarticle;
$smilies = array(
&quot;;-)&quot; => &quot;< src=”/images/site/01.gif” />;&quot;

&quot;:-)-&quot; => &quot;< src=”/images/site/02.gif” />;&quot;

&quot;:-)&quot; => &quot;< src=”/images/site/03.gif” />;&quot;

&quot;:-D&quot; => &quot;< src=”/images/site/04.gif” />;&quot;

&quot;B-)&quot; => &quot;< src=”/images/site/05.gif” />;&quot;

&quot;:-O&quot; => &quot;< src=”/images/site/06.gif” />;&quot;

&quot;:-(&quot; => &quot;< src=”/images/site/07.gif” />;&quot;
);
return str_replace(array_keys($smilies), array_values($smilies), $thisarticle[body]);
</txp:php>

PS: (img is missing just here, for good viewing)

Thanx

Last edited by Ji31 (2006-02-16 00:38:37)

Offline

#2 2006-02-16 00:42:42

zem
Developer Emeritus
From: Melbourne, Australia
Registered: 2004-04-08
Posts: 2,579

Re: Inserting php - replacing of smilies?

FAQ.


Alex

Offline

#3 2006-02-16 00:56:38

Ji31
Member
Registered: 2005-08-24
Posts: 103

Re: Inserting php - replacing of smilies?

> zem wrote:

> FAQ.

Ok, so, if I had good understand, $thisarticle doesn’t work-so what I should use? Or did I understand it wrong (also it is more than possible – my english is not so good)? Or where I have the mystake? I didn’t find anything wrong :-(

Offline

#4 2006-02-16 02:12:40

zem
Developer Emeritus
From: Melbourne, Australia
Registered: 2004-04-08
Posts: 2,579

Re: Inserting php - replacing of smilies?

Follow the recommendations in the FAQ. Use <txp:php>, turn on debugging, use standard PHP debugging techniques, etc.


Alex

Offline

Board footer

Powered by FluxBB