Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#16 2014-10-09 07:06:01

etc
Developer
Registered: 2010-11-11
Posts: 5,675
Website GitHub

Re: chh_if_data revisited

A clever marginal usecase of processing insert after test:

<txp:adi_if_content insert="newer,older">
	<txp:newer>Newer</txp:newer>
	<txp:older>Older</txp:older>
	<txp:article />
</txp:adi_if_content>

Bye-bye pgonly!

Offline

#17 2014-10-10 15:31:22

mrdale
Member
From: Walla Walla
Registered: 2004-11-19
Posts: 2,215
Website

Re: chh_if_data revisited

All progress sounds good, but I’m confused about the current state of tgas, attributes and their abilities.

Offline

#18 2014-10-10 22:06:12

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,373

Re: chh_if_data revisited

mrdale wrote #284708:

All progress sounds good, but I’m confused about the current state of tgas, attributes and their abilities.

Yeah, I know what you mean. I haven’t had a chance to test etc’s solution yet. However this turns out, code readability (& understandability?) is essential as far as I’m concerned.

Offline

#19 2014-10-11 09:09:01

etc
Developer
Registered: 2010-11-11
Posts: 5,675
Website GitHub

Re: chh_if_data revisited

mrdale wrote #284708:

All progress sounds good, but I’m confused about the current state of tgas, attributes and their abilities.

One should speak of current states, since we have two plugin versions atm. Mine works like this:

<txp:adi_if_content [ test="tag1,tag2" | ignore="tag3,tag4" ] [ insert="tag5,tag6" ]>
	...
	<!-- will be processed, but not tested for emptiness -->
	<txp:adi_if_content_ignore><txp:tag7 /></txp:adi_if_content_ignore>
	<txp:tag8 />
	...
	<txp:tag1 /> <!-- will be processed and tested for emptiness -->
	...
	<!-- will be processed after other tags only if the "tested" tags are not all empty -->
	<txp:adi_if_content_insert><txp:tag9 /></txp:adi_if_content_insert>
	<txp:tag6 />
	...
</txp:adi_if_content>

test and ignore are mutually exclusive, choose the one you prefer. If both omitted, all tags except in insert will be tested. ignore and insert act exactly as if tags were wrapped in adi_if_content_ignore and adi_if_content_insert.

Example (try it also without wrapping in adi_if_content):

<txp:adi_if_content insert="newer,older">
	<!-- these will be processed after <txp:article />, so the pagination data will be available -->
	<txp:newer>Newer</txp:newer><txp:older>Older</txp:older>
	<!-- this one will be processed normally and populate the pagination data -->
	<txp:article />
</txp:adi_if_content>

Last edited by etc (2014-10-11 09:19:41)

Offline

#20 2014-10-11 21:26:10

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,373

Re: chh_if_data revisited

Hi etc,

Your solution looks pretty groovy to me. I’ve dropped it into a couple of projects and all seems well. It’s a better job than my attempt, so I reckon you should release it as etc_if_content.

Adi

Offline

#21 2014-10-12 09:44:16

etc
Developer
Registered: 2010-11-11
Posts: 5,675
Website GitHub

Re: chh_if_data revisited

Ha! you know how some people are, they would say etc_plugin = adi_idea + rvm_code. What the name would change, anyway? Adopt whatever approach you prefer in your plugin, I only wanted to share mine, period.

A bit OT, but I’m more and more persuaded that Ruud’s (?) great parser is underexploited. Your plugin was an occasion to tweak it. Now I’m playing with caching the parsing, it gives a 2-3 times acceleration.

Offline

#22 2014-10-12 22:40:52

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,373

Re: chh_if_data revisited

etc wrote #284738:

What the name would change, anyway?

etc_support?

Offline

#23 2014-10-13 07:30:10

jpdupont
Member
Registered: 2004-10-01
Posts: 752

Re: chh_if_data revisited

Adi, etc,

Is it allowed to insert before/after the tags tested ?

Offline

#24 2014-10-13 07:45:36

etc
Developer
Registered: 2010-11-11
Posts: 5,675
Website GitHub

Re: chh_if_data revisited

gomedia wrote #284741:

etc_support?

wouldn’t be any different, whatever prefix, because I like this plugin. Let’s finish with etymology, or there will be no users to support. :)

jpdupont wrote #284752:

Is it allowed to insert before/after the tags tested ?

Yes, and one day it could even be possible to assign some finer processing order to tags.

Offline

#25 2014-10-13 08:25:01

jpdupont
Member
Registered: 2004-10-01
Posts: 752

Re: chh_if_data revisited

Thanks for the hard and fine work, Oleg and Adi !

Offline

#26 2014-10-30 13:08:57

ingleslenobel
Member
Registered: 2014-10-16
Posts: 88

Re: chh_if_data revisited

Hello,

I’m after chh_if_data to make an image captioner and positioner like here but the download link here is now deprecated “Deprecated: Function set_magic_quotes_runtime() is deprecated in /home/shaktaka/public_html/textpattern/lib/txplib_db.php on line 14”

Is this an alternative or would anyone know of a working copy? Seems to work here – I’m after the same sort of thing, alignment and caption below

Thank you!!

Offline

#27 2014-10-30 17:22:17

etc
Developer
Registered: 2010-11-11
Posts: 5,675
Website GitHub

Re: chh_if_data revisited

ingleslenobel wrote #285258:

Is this an alternative or would anyone know of a working copy?

This is a much smarter alternative, which takes into account only (chosen) txp tags, see the OP.

Offline

#28 2014-12-14 21:58:30

jpdupont
Member
Registered: 2004-10-01
Posts: 752

Re: chh_if_data revisited

Hello Adi or Oleg …

Is this plugin now an … orphan plugin :) ?

Offline

#29 2014-12-14 22:07:47

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,373

Re: chh_if_data revisited

jpdupont wrote #286534:

Hello Adi or Oleg …

Is this plugin now an … orphan plugin :) ?

etc’s latest version, as posted here is the one I’ve been using to great effect in a couple of projects.

All it needs is a bit of tidying up in the help department. So no, it’s not an orphan … more of a neglected offspring!

Offline

#30 2014-12-14 22:25:28

etc
Developer
Registered: 2010-11-11
Posts: 5,675
Website GitHub

Re: chh_if_data revisited

jpdupont wrote #286534:

Hello Adi or Oleg …

Is this plugin now an … orphan plugin :) ?

It’s rather everybody’s child is nobody’s child :) But it should still work, something wrong with it?

Offline

Board footer

Powered by FluxBB