Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#16 2008-06-28 07:25:08

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: an attribute named "empty"

uli wrote:

The whole variable stuff is rather unseizable for mere mortals without coding background like (Maniqui and) me

Not sure what “unseizable” means, but yes, we play on the same league (that of those who don’t know what PHP stands for)! :)
I’m trying (hard, and at the same time not that hard, but trying at least) to learn programming, reading a little of Python (that’s the one that we use at work), looking to JS/jQuery code, but I can’t hear the “click” on my head yet. It’s like I have to re-learn everything each time. I know: I have to practice, practice, practice… but can’t find some real situations to do it and so, solidify what I’ve learned.
In the meanwhile, let’s learn to “program” in TXP ;)


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#17 2008-06-28 07:26:59

wet
Developer Emeritus
From: Vöcklabruck, Austria
Registered: 2005-06-06
Posts: 3,416
Website GitHub Mastodon

Re: an attribute named "empty"

maniqui wrote:

There is where I think I spotted an error in the explanation:
Isn’t the driving tag this one: <txp:category_list section="products" categories="a,b,c" ... />? If not, then I don’t get it yet :)
But if indeed it is the driving tag, wet said:
is expandable to more than one section this way by adding more section names

Is that last statement correct?

No, I was terribly wrong with that (early morning here). Forget this part, pronto!

Offline

#18 2008-06-28 07:44:29

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: an attribute named "empty"

wet wrote:

Forget this part, pronto!

Forget what? ;)


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#19 2008-06-28 08:20:08

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

Re: an attribute named "empty"

Some good example usage in there wet, thanks. Definite food for thought on ways to write rather neat navigation structures.

Slightly OT, but related to the original thing that Els/colak suggested; in the absence of a built-in tag that checks if the enclosed tag(s) returned anything, would it be possible to add an FAQ entry to the effect:

TXP does not have a native method for checking if a tag returned output or not, but there is a plugin chh_if_data

fwiw, the only way I can (could) have seen to leverage <txp:variable /> for this kind of thing would be thus:

<txp:variable name="did_it" value='<txp:related_articles match="Category1" />' />
<txp:if_variable name="did_it" value="">
  <txp:related_articles break="li" label="Related Articles" labeltag="h3" limit="5" match="Category1" sort="rand()" wraptag="ul" />
</txp:else />
  <p>No related articles, sorry.</p>
</txp:if_variable>

But under the latest behaviour you can’t check for an “empty” variable (one with no value) since it is erased if the value is empty. Does (or could?) the <txp:if_variable name="some_name" /> — i.e. the tag without a value — test for the existence of said variable? Then the above scenario might be possible without the chh_if_data plugin.

Of course, it’s still borderline undesirable because you need two calls to the same(ish) tag — one to ‘check’ and one to ‘do’ — which will slow the page down. I still think a native “did the contained tag(s) return anything” tag adds value to the core. But perhaps I’m not thinking hard enough about this new tag and the tag-in-tag possibilities.

Last edited by Bloke (2008-06-28 08:20:45)


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

Hire Txp Builders – finely-crafted code, design and Txp

Online

#20 2008-06-28 08:40:39

wet
Developer Emeritus
From: Vöcklabruck, Austria
Registered: 2005-06-06
Posts: 3,416
Website GitHub Mastodon

Re: an attribute named "empty"

Bloke wrote:

Does (or could?) the <txp:if_variable name="some_name" /> — i.e. the tag without a value — test for the existence of said variable?

Intended behaviour is:

  1. <txp:variable name="foo" /> returns the variable’s value.
  2. <txp:variable name="foo" value="" /> erases the variable’s value. The variable still exists, though empty.
  3. <txp:variable name="foo" value="bar" /> sets the variable’s value. Basically this is the same as #2.
  4. <txp:if_variable name="foo"> tests for the existence.
  5. <txp:if_variable name="foo" value="bar"> tests for the value, and therefore also for the existence.

If your tests show that we deviate from this intentions, we need to fix it.

Of course, it’s still borderline undesirable because you need two calls to the same(ish) tag — one to ‘check’ and one to ‘do’ — which will slow the page down.

I don’t think this is 100 percent relevant. Skimming over chh_if_data shows that it parses the contained $thing (it has to), and therefore it ‘does’ & ‘checks’ internally. This might speed things up a little bit, but the difference would probably be minimal (someone might want to do a benchmark on this – not me).

Last edited by wet (2008-06-28 08:47:41)

Offline

#21 2008-06-28 08:51:08

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

Re: an attribute named "empty"

wet wrote:

Intended behaviour is: [snip]

OK, cool, perfect.

Skimming over chh_if_data shows that it parses the contained $thing (it has to), and therefore it ‘does’ & ‘checks’ internally.

D’oh, of course. So the above thing I posted will work. Eeexcellent, as Mr Burns would say.

I’ll crawl back in my box now.


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

Hire Txp Builders – finely-crafted code, design and Txp

Online

#22 2008-06-28 09:35:49

thebombsite
Archived Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: an attribute named "empty"

You remember that “learning curve” you went through when you first installed Textpattern? Well it seems to me that 4.0.7 is going to be deja vu. ;)


Stuart

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#23 2008-06-28 09:39:29

wet
Developer Emeritus
From: Vöcklabruck, Austria
Registered: 2005-06-06
Posts: 3,416
Website GitHub Mastodon

Re: an attribute named "empty"

People are complaining no matter what we do ;-)

  • Conservative development: “The project dies!”
  • Slightly progressive development: “Steep learing curve ahead!”

Offline

#24 2008-06-28 11:20:42

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,316

Re: an attribute named "empty"

Julián wrote:

but I can’t hear the “click” on my head yet. It’s like I have to re-learn everything each time.

I can find myself herein very well!!

In the meanwhile, let’s learn to “program” in TXP ;)

Yeah! It’s seems to become something like that. Devs, release it as 4.1, my proposal. Opens too many doors to give just one tenth of a decimal place!
Unseizeable”, BTW, if I used it correctly, should express something like “too theoretical, not graspable”.

Stuart wrote:

You remember that “learning curve” you went through when you first installed Textpattern? Well it seems to me that 4.0.7 is going to be deja vu. ;)

Yup! Gives us stuff enough to mull over. Rust never sleeps, here’s our antidote. Just don’t eat the whole packet at once ;)

Last edited by uli (2008-06-28 11:21:28)


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#25 2008-06-28 11:39:29

thebombsite
Archived Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: an attribute named "empty"

I remember “that click” from when I first started using TXP back in the “gamma” days. And I’m not complaining at all Robert. It’s just a lot of stuff to get your head around all in one go, particularly when you start combining the new “tag parser” abilities (which I do understand) with the new “variables” stuff. I don’t think I’ve fully understood half of this thread yet. Probably have to read through it 10 times before I get “that click” again. ;)

Last edited by thebombsite (2008-06-28 11:40:09)


Stuart

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#26 2008-06-28 12:12:35

wet
Developer Emeritus
From: Vöcklabruck, Austria
Registered: 2005-06-06
Posts: 3,416
Website GitHub Mastodon

Re: an attribute named "empty"

May I invite you to attempt a truly positive point of view:

  • With Textpattern 4.0.7, every single bit of your current knowledge stays valid.
  • Every novelty in Txp 4.0.7 simply expands the current feature set, there’s no change in existing behaviour.
  • You can continue to work as before and gradually apply new features, for instance swap out asy_wondertag for natively parsed attributes.

Offline

#27 2008-06-28 12:35:38

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,316

Re: an attribute named "empty"

Please don’t feel gnawed, Robert. The lack is on our side, we have to keep pace!


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#28 2008-06-28 12:50:01

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: an attribute named "empty"

No complaints at all! I feel exactly the same as Stuart, Julián and Uli, but I just love steep learning curves, just have to shift to low gear ;)

BTW, just found this in an old weblog post:

The existing stable branch of Textpattern […] This necessitates very few features being added (as in, nothing large or sweeping […]

:))

Offline

#29 2008-06-28 13:16:05

wet
Developer Emeritus
From: Vöcklabruck, Austria
Registered: 2005-06-06
Posts: 3,416
Website GitHub Mastodon

Re: an attribute named "empty"

“Stable” is not “stagnant”. “Stable” means “we won’t break stuff (unless it promises loads of fun)”.

Offline

#30 2008-06-28 14:08:59

maverick
Member
From: Southeastern Michigan, USA
Registered: 2005-01-14
Posts: 976
Website

Re: an attribute named "empty"

wet wrote:

  • Slightly progressive development: “Steep learing curve ahead!”

Me – I’m semi-lost, a tad confused, but loving it! Keep Bringing it on! :-P

Offline

Board footer

Powered by FluxBB