Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-12-15 13:44:20

rathersplendid
Plugin Author
From: London
Registered: 2008-05-02
Posts: 163
Website

[request] Per section Write Tab Textile settings..

I’m currently building a site for a client who wants to have the ability to update the site themselves. The testimonials section on the site will not use Textile because of the specific way I have presented the quotations.

Is there a plugin that will allow me to set, on a per section basis, the Textile preferences? Or can it be created?

Many thanks

Zander


Admin Themes Prometheus | Stung | <txp:coder/
My Portfolio | ɹǝpuɐz.com | @MrMartineau
<txp:coder /> – Convert your designs into Textpattern-based websites
jQuery Style | @jquerystyle

Offline

#2 2009-12-15 14:13:33

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

Re: [request] Per section Write Tab Textile settings..

rathersplendid wrote:

Is there a plugin that will allow me to set, on a per section basis, the Textile preferences?

Not that I know of.

If you don’t mind a bit of manual intervention you can cheat. Write a simple plugin that intercepts the Save/Publish step on TXP’s Write tab and forces the textile body to be Leave text untouched. A bit like this:

if (@txpinterface == 'admin') {
   register_callback('smd_per_sec_textile', 'article', '', 1);
}

function smd_per_sec_textile($event, $step) {
   if (gps('save') || gps('publish')) {
      if ( in_array(gps('Section'), array("section1", "section2")) ) {
         $_POST['textile_body'] = LEAVE_TEXT_UNTOUCHED;
      }
   }
}

Create a new plugin using the Plugin Composer, bung that code in, set its type to Admin and activate it (change the plugin function name smd_per_sec_textile in both places if you prefer to call it something else).

Then, to configure it, alter the line with section1, section2, etc to contain the section names you want to force Textile OFF.

Job’s a good ‘un I think.

Last edited by Bloke (2009-12-15 14:14:54)


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 2009-12-15 14:47:58

rathersplendid
Plugin Author
From: London
Registered: 2008-05-02
Posts: 163
Website

Re: [request] Per section Write Tab Textile settings..

Stef, you’re a star!! Thank you so much.

I managed to create the plugin (a first for me) and it works perfectly. I didn’t change the name, because, let’s face it you did all the work.

Would you like the plugin code?


Admin Themes Prometheus | Stung | <txp:coder/
My Portfolio | ɹǝpuɐz.com | @MrMartineau
<txp:coder /> – Convert your designs into Textpattern-based websites
jQuery Style | @jquerystyle

Offline

#4 2009-12-15 14:56:06

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

Re: [request] Per section Write Tab Textile settings..

rathersplendid wrote:

Stef, you’re a star!! Thank you so much.

Excellent. Glad it fit the bill and you’ve had your first taste of plugindom.

Would you like the plugin code?

Nah, it’s fine thanks. It’s preserved here on the forum for posterity, you have a copy and I have my mockup version on my dev site. So that’s at least three places in the world, thus mostly satisfying the data survivity law :-)

Last edited by Bloke (2009-12-15 14:56:57)


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

Board footer

Powered by FluxBB