Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 Yesterday 09:12:34

abu
Plugin Author
From: Switzerland
Registered: 2025-04-03
Posts: 10
GitHub GitLab Mastodon

My first plugin: abu_catcloud

I started writing this plugin for my own use while migrating my site from Bludit to Textpattern.
It displays a weighted list of used article categories, and I think it might be useful for others too.

https://codeberg.org/abu/abu_catcloud

Offline

#2 Yesterday 16:06:33

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,014
Website GitHub

Re: My first plugin: abu_catcloud

Nice idea! Welcome to plugin authorship.

When you’re ready to update to the next version, you can save yourself some bytes and manual processing by using doWrap() which takes the wraptag, break and class attributes and applies them to the passed contained content/list. It also gives you access to wrapform, breakform, breakby and host of other global attributes, plus the ufo/spaceship replacment <+>.

There’s a companion doLabel() for handling label/labeltag, although that function is a bit… pedantic, shall we say, so not everybody uses it.

I’d love our new UI Class library to be able to handle some of this stuff more intuitively over time, so we may farm more processing over, as we improve the library.

Thank you for sharing your plugin.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#3 Today 07:00:24

abu
Plugin Author
From: Switzerland
Registered: 2025-04-03
Posts: 10
GitHub GitLab Mastodon

Re: My first plugin: abu_catcloud

Thanks for your welcome and your suggestions.

This brings me to a long-prepared question: Can I find some documentation for functions like extract(), parse(), getRows(), and now doWrap()? Or do I have to skim the core code for them?

Thanks
abu

Offline

#4 Today 07:34:09

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 5,038
Website GitHub

Re: My first plugin: abu_catcloud

abu wrote #340923:

Can I find some documentation for functions like extract(), parse(), getRows(), and now doWrap()? Or do I have to skim the core code for them?

Most of the internal functions are indeed documented in the core or on php.net (in the case of extract() for example), and you can look them up easily on GitHub by searching in the Textpattern repo and prefixing your search with function, e.g. function getRows and then click on the line number of the relevant search match (which brings you here for getRows()). The phpdoc block is mostly directly above the function showing usage and parameters, and clicking on a function in the code will usually show you where it is used in the right-hand panel (sometimes you need to “show more” to see its use in other files). If you go up a level in the right-hand pane (weirdly labelled “All symbols” in English), you’ll also see an overview of all parallel functions in that file in case you’re not sure whether you’ve got the right function.


TXP Builders – finely-crafted code, design and txp

Offline

#5 Today 11:26:45

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,014
Website GitHub

Re: My first plugin: abu_catcloud

Yeah, as mentioned, we don’t have much documentation on core code anywhere but the code. All user-facing documentation is mainly tag and interface usage. We do have high level developer information including stuff on what callback hooks are available (which will need updating for Txp 4.9.0) but generally, browse the code – especially the utility functions in textpattern/lib or textpattern/publish – if you want to find out about how something works.

They’re mainly compartmentalised into their usability groups. For example, database interaction in txplib_db.php, txplib_publish.php for article parsing, etc, but there is some crossover in things like txplib_forms.php and txplib_html.php (both of which will be replaced by the textpattern\vendors\Textpattern\UI library). The dreaded, and behemoth, txplib_misc.php houses everything common.

Tongue-in-cheek word of warning: parse(), processTags() and lAtts() are pure magic. Just use them and be thankful that someone (not me!) has provided them. To understand them is surely to delve into madness… :)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#6 Today 14:17:34

abu
Plugin Author
From: Switzerland
Registered: 2025-04-03
Posts: 10
GitHub GitLab Mastodon

Re: My first plugin: abu_catcloud

Huge thanks to both of you, Jakob and Bloke.
Skimming the core code is fully OK for me; I just wanted a confirmation for unfound documentation.

Offline

Board footer

Powered by FluxBB