Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#31 2008-06-28 14:14:15

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

Re: an attribute named "empty"

wet wrote:

  • You can continue to work as before and gradually apply new features, for instance swap out asy_wondertag for natively parsed attributes.

I love the edge, so I have the latest svn up on several of my sites. Am using the new parser and nested tags in a very simple way at Missional (the site is a work-in-progress)

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

:D

Can’t make an omlette unless you break some eggs

Last edited by maverick (2008-06-28 16:03:27)

Offline

#32 2008-06-28 15:51:42

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

Re: an attribute named "empty"

Julián (I!) wrote:

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

Just to clarify: I wasn’t talking specifically about TXP here, nor about re-learning everything each time in TXP.
I was talking about my experience with general programming (Python, PHP, JS/jQuery).

wet wrote:

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

I love all this new things wet and ruud (an other code contributors, if they exist) are adding to TXP.
I’m just bothering wet with my long and uncomprehensible dissection posts because I want to be prepared when the time comes. I want to hear that “click” (music to my ears) again.


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#33 2008-06-28 16:14:05

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

Re: an attribute named "empty"

maniqui wrote:

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

Just to clarify: I wasn’t talking specifically about TXP here, nor about re-learning everything each time in TXP.
I was talking about my experience with general programming (Python, PHP, JS/jQuery).

Understood you perfectly well :)


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

Offline

#34 2008-06-29 09:41:14

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,912
Website

Re: an attribute named "empty"

This is the one post I get, and all I need to know right now. :)

But I dooooooooo like all this tag parsing stuff and look forward to discovering new ways to simplify and empower at the same time.

Thank you, devs, for the innovation fix (as in drug injection).

Offline

#35 2008-06-29 11:46:53

redbot
Plugin Author
Registered: 2006-02-14
Posts: 1,410

Re: an attribute named "empty"

I’m very happy with the new, incoming features (I’m also happy to see that I’m not the only one to have problems understanding some of them) and obviously I think the txp developers deserve my eternal gratitude.

Nonetheless – and for what is worth – I’d like to express some minor concerns:

1) If it was for me – especially with regards to future novice users – I would in some way differentiate between “basic” tags and “advanced” tags in the documentation.
In fact IMHO one of Textpattern main strength has always been the use of xml-style tags, so resulting immediatly familiar for html “coders” and designers. But the introduction of the new “txp:variable” tag, for example, though mantaining his “XML tag” form will probably result more familiar to programmers rather than designers and I fear that it can turn away new potential users. The same is perhaps true for the “tags as attribute” feature (wich I understand and appreciate very much)

2) Back to the original topic, and again with an eye to novice users and ease of use, I don’t understand why a “<txp:if_data>” tag can’t be added.
Sure it seems that the same result will be achieved with <txp:variable> but I think in some cases having two tags with partially “overlapping” functionality is ok. Isn’t it true, for example, that with the new tag parser <txp:related_articles /> could completely be replaced with <txp:article_custom />?

That’s all, please notice I’m not – in any manner – criticizing the developers nor I wan’t to sound destructive.
On the contrary, these are only minor – and probably useless – considerations which won’t stop me to thank the devs again and again.

Last edited by redbot (2008-07-02 11:02:41)

Offline

#36 2008-08-16 23:17:48

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

Re: an attribute named "empty"

^^

@redbot: both very valid concerns, both well explained.

The most important features on TXP 4.0.7 (new tag parser, tags in tags and txp:variable/txp:if_variable tags) open a new world of possibilities and abilities, but the may make TXP learning curve a little more stepped.
And being that TXP is also aimed at web-designers/web-developers who sometimes doesn’t have any programming experience, I agree that it could turn away new potential users and also think their should be tagged as “Advanced Tags” (or something more funny like “Super advanced magic tricks using basic and advanced txp tags”).

Basic txp:tags (those used for basic tasks) have demonstrated to be enough for both doing both basic/complex sites.
I know we will eventually find ways to use the new 4.0.7 features (“advanced”) for achieving basic/complex tasks , but I think there aren’t too many useful examples of real-world usefulness yet.

Of course it’s also a selling point: it shows how many advanced/complex (hopefully, also useful) things can be done with TXP.
But at the same it may scare those who see just “complexity”. And certainly, an “XML”-style tag inside another “XML”-style tag as attribute looks like complexity, IMHO. Also, the word “variable” can also scare a few ones…

Regarding your second concern, I agree with you. Even if we can emulate a txp:if_data using just txp:variable and txp:if_variable (as wet explained), it will be a nice tag (txp:if_data) to have.
But then, there is a plugin (chh_if_data) which already does the job. It could be then made it to the core and improve it (if there is any room for improvement). Also, chh_* plug-ins seems to be abandoned, so it will be nice to make it to the core.

Now, let’s point to a feature that will make things easier and tidy: txp:article/txp:article_custom (and a few others) as container tags. That will make things easier to understand and to do, both for novices users and expert users.

So, in TXP 4.0.7, we will have both new simplicity and complexity: basic/easier and advanced/harder new ways of doing same/new things at the same time: that’s balance!.

Thanks again to devs for all the


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#37 2008-08-17 07:27:04

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

Re: an attribute named "empty"

maniqui wrote:

Thanks again to devs for all the

…fish?

Offline

#38 2008-08-17 07:58:42

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

Re: an attribute named "empty"

New tags and parsing features don’t make the learning curve steeper, only longer; They just allow you to continue learning new things if you need them. Users that are currently at the end of the learning curve can choose in 4.0.7: use what they already know… or learn more.

The difference between basic and advanced tags differs for all users. Some people find if_different easy to use, while others fail to grasp how it’s supposed to work.

Offline

#39 2008-08-17 12:16:54

redbot
Plugin Author
Registered: 2006-02-14
Posts: 1,410

Re: an attribute named "empty"

maniqui.
thanks for the kind words, I agree with you (even if you seem to agree with me).

ruud wrote:

New tags and parsing features don’t make the learning curve steeper, only longer; They just allow you to continue learning new things if you need them. Users that are currently at the end of the learning curve can choose in 4.0.7: use what they already know… or learn more.

I have a slightly different approach here. As I said before, I was referring only to documentation, with particular regard to novice users. I like all the new features and I’m sure they will prove to be very useful (to begin with the new tag parser). Nonetheless I’m convinced that a clear distinction between basic and advanced tags can help from an “usability” point of view and can contribute to a smoother learning curve.

The difference between basic and advanced tags differs for all users. Some people find if_different easy to use, while others fail to grasp how it’s supposed to work.

That’s true. But if I have to learn a programming manual I prefer to learn one which makes it clear from the index how it is structured, which are the basic chapters and the advanced ones.
Clearly the same content can be “presented” quite differently (all in all we are talking about documentation, not a novel) depending on the target audience so probably our different views on the matter are due to different assumptions on which should be the main target audience. You seem to have in mind a more advanced audience while I think novice users should be privileged (and this should not harm the more advanced users so much).

Following the same logic I continue to think an hypothetic “if_data” tag could happily coexist with the txp:variable” tag and it should be into the core.

Ok now I will stop complaining as I realize I went totally off topic now and all in all these are not crucial problems.

maniqui wrote:

Thanks again to devs for all the

Ouch! it’s happened aga

Last edited by redbot (2008-08-17 12:23:05)

Offline

#40 2008-08-17 14:09:13

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

Re: an attribute named "empty"

redbot wrote:

Ouch! it’s happened aga

…aga khan?

Last edited by Gocom (2008-08-17 14:09:50)

Offline

#41 2008-10-30 15:37:29

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

Re: an attribute named "empty"

wet wrote:

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.

I’m sure I’m overlooking or misunderstanding something, but I just can’t figure out why my following code doesn’t work:

<txp:variable name="file_count" value='<txp:file_download_list category='<txp:l10n_get_lang type="short" />' />' />

<txp:if_variable name="file_count">

<h3>Some Header</h3>

<txp:file_download_list category='<txp:l10n_get_lang type="short" />' wraptag="ul" break="li" />

</txp:if_variable>

I’m checking if there are files in a given category in order to only display the header if there are files. There are in fact two files, but the condition returns false. This is the relevant part of the tag trace:

	<txp:file_download_list category='<txp:l10n_get_lang type="short" />' />
		[attribute 'category']
		<txp:l10n_get_lang type="short" />
		[/attribute]
		[SQL (0,000148057937622): select *,`l10n_description_nl_nl` as `description` from txp_file where 1=1 and category IN ('nl') and status = '4' order by filename asc limit 0, 10]
		[SQL (8,48770141602E-5): select Form from txp_form where name='files']
		[Module: files]
		<txp:file_download_link>
			<txp:file_download_description />
		</txp:file_download_link>
		[Module: files]
		<txp:file_download_link>
			<txp:file_download_description />
		</txp:file_download_link>
	<txp:if_variable name="file_count">
		[<txp:if_variable name="file_count">: false]
	</txp:if_variable>
[ ~~~ secondpass ~~~ ]
<txp:variable name="file_count" value='<a href="http://mlptest.casadonamaria.nl/file_download/1/route_lissabon_vilacova_nederlands.pdf">
Van Lissabon naar Vila Cova de Alva
</a>
<a href="http://mlptest.casadonamaria.nl/file_download/2/route_porto_vilacova_nederlands.pdf">
Van Porto naar Vila Cova de Alva
</a>' />
 -->

It looks like the variable’s value is set, but after [ ~~~ secondpass ~~~ ] (whatever that may be, but I’m guessing that nothing is supposed to happen after it?)

Offline

#42 2008-10-31 02:21:04

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

Re: an attribute named "empty"

Try this:

<txp:variable name="file_count" value='<txp:file_download_list category="<txp:l10n_get_lang type="short" />" />' />
...

Offline

#43 2008-10-31 16:16:29

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

Re: an attribute named "empty"

Thanks Robert, but now it always returns ‘true’… Maybe it’s my setup? I’m using the MLP Pack and languages are nl, en, pt. I created identical file categories: ‘nl’, ‘en’, ‘pt’. This is the tag trace of a pt page, where the condition should return false, because there are no files in category ‘pt’:

	<txp:variable name="file_count" value='<txp:file_download_list category="<txp:l10n_get_lang type="short" />" />' />
		[attribute 'value']
		<txp:l10n_get_lang type="short" />
		[/attribute]
	<txp:if_variable name="file_count">
		[<txp:if_variable name="file_count">: true]
		<txp:file_download_list category='<txp:l10n_get_lang type="short" />' wraptag="ul" break="li" />
			[attribute 'category']
			<txp:l10n_get_lang type="short" />
			[/attribute]
			[SQL (0,000139951705933): select *,`l10n_description_pt_pt` as `description` from txp_file where 1=1 and category IN ('pt') and status = '4' order by filename asc limit 0, 10]
	</txp:if_variable>
[ ~~~ secondpass ~~~ ]
 -->

Form:

<txp:variable name="file_count" value='<txp:file_download_list category="<txp:l10n_get_lang type="short" />" />' />

<txp:if_variable name="file_count">

<h3>Downloads</h3>

<txp:file_download_list category='<txp:l10n_get_lang type="short" />' wraptag="ul" break="li" />

</txp:if_variable>

HTML output:

<h3>Downloads</h3>

‘files’ form (if that matters):

<txp:file_download_link>
<txp:file_download_description />
</txp:file_download_link>

Last edited by els (2008-10-31 16:25:13)

Offline

#44 2008-11-03 21:41:34

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

Re: an attribute named "empty"

(Apologies for bumping…)

Of course I can use other ways to do this so I don’t really need this code to work, but what I do need is to test my understanding of the variable tag’s workings.

So, does my code above make any sense at all? Or where do I go wrong?

Offline

#45 2008-11-04 22:58:51

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

Re: an attribute named "empty"

<txp:variable name="foo" value="" /> erases the variable’s value. The variable still exists, though empty.

<txp:if_variable name="foo"> tests for the existence.

So it always returns true, once the variable’s value has been set, doesn’t matter if it’s empty or not, right?

<txp:if_variable name="foo" value="bar"> tests for the value

But how do I test for an empty value? <txp:if_variable name="foo" value=""> always returns false…

Sigh.

(I don’t mind if I don’t get any replies, honest; I’ll just go on talking to myself until I figure it out…)

Offline

Board footer

Powered by FluxBB