Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2004-10-08 15:44:46

cstorm
New Member
Registered: 2004-10-07
Posts: 3

Writing my first txp plugin...

Ok, I’m getting thrown for a loop dealing with someone else’s API… I’m just writing a quick test plugin to make sure I understand the API, but somewhere, I’m hosing something up…

Here’s the plugin code:

———————————————————————————-
function cas_test2($atts) { if (is_array($atts)) extract($atts); $return.= “<br>hello crewel world p1=$p1 and p2=$p2”; return ($return); }
———————————————————————————-

And here’s the reference in one of my articles:
———————————————————————————-
<txp:cas_test2 p1=“123” p2=“456” />
———————————————————————————-

It still comes out like this (ie. somewhere atts are being dropped)

———————————————————————————-
hello crewel world p1= and p2=
———————————————————————————-

$atts IS an array, I dropped in an extra line bound to the if statement just to check to make sure, so I would guess there’s something wrong with the reference in the article…

Anyone see what I’m missing?

Thanks in advance,

cstorm

Offline

#2 2004-10-08 18:19:44

cstorm
New Member
Registered: 2004-10-07
Posts: 3

Re: Writing my first txp plugin...

Nice… well, since I can’t seem to post txp tags, maybe I’ll do it without the brackets…

txp:cas_test2 p1=“123” pw=“456” /

Last edited by cstorm (2004-10-08 18:20:20)

Offline

#3 2004-10-08 23:00:48

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

Re: Writing my first txp plugin...

Try var_dump($atts).

It could be that txp doesn’t like numbers in attribute names – I’m not sure, never tried.


Alex

Offline

#4 2004-10-09 14:11:51

cstorm
New Member
Registered: 2004-10-07
Posts: 3

Re: Writing my first txp plugin...

That was it… replaced p1 and p2 with p and q, now it works… One for the buglist, perhaps?

Offline

#5 2004-10-09 14:55:31

Dean
Founder (Gone, but not forgotten)
From: Languedoc
Registered: 2004-02-14
Posts: 235
Website

Re: Writing my first txp plugin...

Naw, that’s okay. I’ve updated the attributes cruncher – splat() – in publish.php to accept 0-9 as well as a-z. Will be available next update.


text*

Offline

#6 2004-10-09 16:33:23

kennethlove666
Member
From: arkansas
Registered: 2004-04-27
Posts: 107
Website

Re: Writing my first txp plugin...

$q might be a bad variable name to use, as it’s the query string for the search engine. :)


Listen to Kenneth

Offline

Board footer

Powered by FluxBB