Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2005-09-10 14:04:49

aba
Plugin Author
Registered: 2004-04-14
Posts: 119

Re: Textpattern Plugin Template

I tried to follow the hint to copy my plugin in the cache dir and test it there – you might want to edit the descripton to include a short note about setting the variable $test in a plugin to something that is not empty to avoid compiling the plugin. It took me a few minutes to figure it out (despite that it is quite obvious when checking the tpl-source).

Thanks for the template and the how-to, saved me a lot of time.

Offline

#14 2005-09-11 04:45:33

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: Textpattern Plugin Template

aba, if you did it correctly, you don’t have to change anything, it just works.

Offline

#15 2005-09-11 10:03:04

aba
Plugin Author
Registered: 2004-04-14
Posts: 119

Re: Textpattern Plugin Template

depends what you mean with “works”.

If I copy the plugin in the plugin cache it works by compiling the plugin code every time I want to see the page in the browser. When using $test=‘1’; in the plugin source the plugin gets executed – so I may check out whether the plugin works and edit it with an syntax highlighting editor an when I change $test to ‘0’ I get the plugion code again.

If it works for you without touching $test and you can use the plugin by including zem_tpl.php I’m interested in how you achieved it. Judging from the source the plugin gets compiled when $test is not defined and executed when $test is defined.

Because I’m lazy my plugin gets edited in the same path than textpattern, makes development a lot faster.

Offline

#16 2005-09-11 21:44:55

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: Textpattern Plugin Template

No, if you use both files in their correct places, it works perfectly:
“(Note: do not put zem_tpl.php in the same directory)”

zem_tpl.php is for the compiling. You put it somewhere else. You put your plugin in whatever your plugin cache dir is, and it gets executed. Put it in the same folder as zem_tpl and it gets compiled. All the work has already been done for you.

Offline

#17 2005-09-11 22:18:30

aba
Plugin Author
Registered: 2004-04-14
Posts: 119

Re: Textpattern Plugin Template

zem_tpl.php is not in the same directory (I use textpattern/lib).
I don’t know why Rob decided to put a check for $test into it, but it is there (check the first lines of it). I don’t copy the plugin where I want to compile it, it just has a $test=‘1’; at the beginning and whenever I want to compile it I change this to $test=‘0’;

Works for me – and it has to have a purpose. ;)

Offline

#18 2006-04-08 00:32:53

baby
Plugin Author
From: Buenos Aires, Argentina
Registered: 2005-10-16
Posts: 95
Website

Re: Textpattern Plugin Template

Hi zem…

I noticed a problem (mostly an annoyance rather than a problem)… I dowloaded zem_tpl-0.4.tar.gz and gave it a quick try… it works OK, but if I run from the command line in a unix machine, the line endings come out with a mixture of \n and \r\n… I guess it must work OK in windows…

Now, I’m not a PHP expert, but I can’t find an equivalent to Perl’s $\ (or $OUTPUT_RECORD_SEPARATOR)… anyway, I don’t think you could solve it with this either.

I guess the problem comes from the fact that zem_tpl.php is windows formatted (i.e. it has \r\n as end of line markers), and since the program uses here-documents for some lines (the <<< EOF trick), they come out as \r\n, whereas the simple \n’s printed within the program, come out as, well, only \n’s in unix.

Also, the chunk_split() function defaults to \r\n

Maybe you could package the .tar.gz version withount the \r’s and with the last line like this:

return $header . "\n\n" . trim(chunk_split(base64_encode(serialize($plugin)), 72,"\n")). "\n";

(note the extra ,"\n" in the call to chunk_split()), and leave the .zip version as is… that is, most windows people will download the .zip and most unix people will download the .tar.gz…

maybe there’s an elegant solution to this?

maybe it just doesn’t matter?


Mariano AbsatzEl Baby

I don’t suffer from insanity. I enjoy every minute of it.

Offline

#19 2006-09-01 17:11:05

baby
Plugin Author
From: Buenos Aires, Argentina
Registered: 2005-10-16
Posts: 95
Website

Re: Textpattern Plugin Template

Hi zem…

Shouldn’t it be noted here that the plugin template is now maintained in the svn repo ?


Mariano AbsatzEl Baby

I don’t suffer from insanity. I enjoy every minute of it.

Offline

#20 2007-03-16 03:59:57

placenamehere
Archived Plugin Author
Registered: 2004-11-21
Posts: 88
Website

Re: Textpattern Plugin Template

Was looking at this template again tonight and was thinking that perhaps in addition to an author_uri it might be useful to add a plugin_uri to the metadata list.


Site: placenamehere.com
Microformat Plugin: pnh_mf

Offline

Board footer

Powered by FluxBB