Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2017-03-10 20:13:59

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

Compiler config (zem_tpl.php)

I’m trying to modernise how I have my local plugin repos set up, and am failing to compile plugins — the file is created but is empty. My old setup is rather silly, with an alias for each plugin file to the directory where zem_tpl.php lives. I want to get rid of all the silly aliases, and also start compiling with the version of Textile that comes within Txp. I have a directory structure like so:

.
+-- Textpattern
|   +-- textpattern-plugin-template
|   |   +-- zem_tpl.php
|   |   +-- (etc.)
|   +-- plugins
|   |   +-- soo_page_break
|   |   |   +-- soo_page_break.php
|   |   |   +-- releases
|   |   |   |   +-- soo_page_break-0.1.1.txt

My textpattern repo is elsewhere, so I’ve uncommented the define('txpath' line in zem_tpl.php and given it the full path to textpattern/textpattern. Then in my plugin file (soo_page_break.php in this example) I’ve added the path to zem_tpl.php. I’ve tried it both with relative path and full path. Blank file each time.

Ideas, or hints how to debug this?

Ta.


Code is topiary

Offline

#2 2017-03-10 21:08:12

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

Re: Compiler config (zem_tpl.php)

OK, so the hangup happens here:

    if (defined('txpath')) {
        $loader = new \Textpattern\Loader(txpath.'/lib');
        $loader->register();
    }

What do I need to do to enable the autoloader?

[Edit:] tried adding this just above the new \Textpatter\Loader call above:

include txpath.'/vendors/Textpattern/Loader.php';

but that wasn’t enough. Class Loader still doesn’t exist after the include. File permissions, I reckon.

Loader.php has very restrictive permissions.

But that wasn’t the problem; the include statement returns OK. Still no Loader class, though.

Last edited by jsoo (2017-03-10 21:54:43)


Code is topiary

Offline

#3 2017-03-10 21:54:30

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,250
Website GitHub

Re: Compiler config (zem_tpl.php)

It’s not you. I screwed up the templater. That pigging new $trace functionality again. Gimme five mins and I’ll push a new template to the repo.


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

#4 2017-03-10 21:58:41

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,250
Website GitHub

Re: Compiler config (zem_tpl.php)

Ok, go. Four minutes and 11 seconds.

Sorry about that, and thanks for the nudge.


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

#5 2017-03-10 22:06:27

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

Re: Compiler config (zem_tpl.php)

Thanks bro! Working now.


Code is topiary

Offline

#6 2017-03-10 22:27:53

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

Re: Compiler config (zem_tpl.php)

Now to figure out how to work with the new Textile version. In particular, how to get notextile blocks happening again. Have to look at it later.

[Edit:] Ah, I’m behind the times. The Textile treatment only happens on plugin verify, and is in restricted mode. Good motivation for me to really learn the new Textile.

Last edited by jsoo (2017-03-11 01:22:33)


Code is topiary

Offline

#7 2017-03-11 02:19:06

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

Re: Compiler config (zem_tpl.php)

Hmmmm. Not so happy with the restricted Textile. Didn’t realize this one strips attributes from Textile syntax such as p(some-class).

I guess I’ll be looking into some sort of build process for pre-processing the help section into raw HTML.


Code is topiary

Offline

#8 2017-03-11 20:12:50

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

Re: Compiler config (zem_tpl.php)

So I forked the plugin template/compiler package and modified it to allow plugin help text in a separate file, in either Textile or Github-flavoured Markdown. (Parser not included!)

While it will still work in the standard configuration, for my own usage I am no longer coupling it to a Txp installation. Will be happy to provide notes on how I have it arranged with PHP-Textile and Parsedown if anyone’s interested.

https://github.com/jsoo/textpattern-plugin-template

I expect there are about as many compiler arrangements as there are Txp plugin authors; this one suits my needs. Spurred by the fact that it is basically impossible to give examples of Textile syntax if the example itself undergoes Textile parsing. And by the fact that Github-Flavoured Markdown makes a lot of sense for anything hosted on GitHub.


Code is topiary

Offline

#9 2017-03-13 10:25:10

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

Re: Compiler config (zem_tpl.php)

Since got it working with a Txp installation, making config easier.


Code is topiary

Offline

#10 2017-07-03 19:39:08

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: Compiler config (zem_tpl.php)

zem_tpl currently doesn’t convert textile help into HTML if you use option ©, which is to define the constant txpath to point to a textpattern installation.

To fix this, replace:

    @include('classTextile.php');
    if (defined('txpath')) {
        global $trace;
        include txpath.'/lib/class.trace.php';
        include txpath.'/vendors/Textpattern/Loader.php';
        $trace = new Trace();
        $loader = new \Textpattern\Loader(txpath.'/lib');
        $loader->register();
    }

With:

   if (defined('txpath')) {
        global $trace;

        include txpath.'/lib/txplib_misc.php';
        include txpath.'/lib/class.trace.php';
        include txpath.'/vendors/Textpattern/Loader.php';

        $trace = new Trace();

        $loader = new \Textpattern\Loader(txpath.'/vendors');
        $loader->register();

        require txpath.'/lib/classTextile.php';
    } else {
        @include('classTextile.php');
    }

Offline

#11 2017-07-04 10:52:46

makss
Plugin Author
From: Ukraine
Registered: 2008-10-21
Posts: 355
Website

Re: Compiler config (zem_tpl.php)

And what about xml format of the help file?

<?xml version="1.0" encoding="utf-8"?>
<resources>
<help>
	<item format="textile"><![CDATA[
		h3. What do you want to do next?
		...
	]]></item>
	<item format="textile"><![CDATA[
		h3. Other textile block, why not?
		...
	]]></item>
	<item format="markdown"><![CDATA[
		# Future support for *Markdown*
		...
	]]></item>
	<item><![CDATA[
		<h3>Bulk HTML</h3>
		...
	]]></item>
	<item format="css"><![CDATA[
		#aks h1 { color: #000000; font: 20px sans-serif;}
	]]></item>
</help>
</resources>

In its original form, it is unchanged to store it everywhere: in the plugin itself, in the database, in the flat files, etc.
Handle help file only when displayed.


aks_cron : Cron inside Textpattern | aks_article : extended article_custom tag
aks_cache : cache for TxP | aks_dragdrop : Drag&Drop categories (article, link, image, file)

Offline

#12 2017-07-06 13:53:22

makss
Plugin Author
From: Ukraine
Registered: 2008-10-21
Posts: 355
Website

Re: Compiler config (zem_tpl.php)

An example of realization of my idea: #914
Slightly changed the format of the xml file.

Last edited by makss (2017-07-06 13:54:22)


aks_cron : Cron inside Textpattern | aks_article : extended article_custom tag
aks_cache : cache for TxP | aks_dragdrop : Drag&Drop categories (article, link, image, file)

Offline

Board footer

Powered by FluxBB