Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2011-01-16 11:44:15

leafy_loader
Member
Registered: 2008-09-25
Posts: 96

Plugin creation basics

I’m teaching myself how to create a plugin (clientside). To start with I just need to know how to echo a message but wether I use return or echo the message appears just after the <body> tag which is no good to me.

Where am I going wrong? I’m placing my new txp tag within the markup I want it to appear in but with no luck

Offline

#2 2011-01-16 12:01:08

leafy_loader
Member
Registered: 2008-09-25
Posts: 96

Re: Plugin creation basics

Update:

The problem seems to occur only on the home (default) page

Offline

#3 2011-01-16 12:33:36

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
Website

Re: Plugin creation basics

function llo_world($atts, $thing = NULL)
{
	extract(lAtts(array(
 		'name' => '',
	), $atts));

// Tag contents take precedence over name attribute $name = $thing ? $thing : $name;

// no output unless name is provided return $name ? ‘Hello, ‘ . $name . ‘!’ : ‘’;
}

That’s for a dual-mode (single or container) tag; for a single-tag-mode only version you don’t need to include $thing in the function signature. Using the new tag:

<txp:llo_world>leafy_loader</txp:llo_world>
<txp:llo_world name="leafy_loader" />

Code is topiary

Offline

#4 2011-01-16 12:39:24

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: Plugin creation basics

Could you post the code you are using?

Some docs:

Edit. Very cool example Jeff ;-)

Last edited by Gocom (2011-01-16 12:41:32)

Offline

#5 2011-01-16 14:18:25

leafy_loader
Member
Registered: 2008-09-25
Posts: 96

Re: Plugin creation basics

Thanks for the responses. The problem has ‘magically’ disappeared. I think it may have been a cache issue.

Offline

Board footer

Powered by FluxBB