Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2016-06-01 08:53:03

NicolasGraph
Plugin Author
From: France
Registered: 2008-07-24
Posts: 860
Website

An attribute without any value

Hi,
How about using an attribute without any value (like the multiple attribute of select)?
I’m thinking to use it for attributes which support only on/off values (usually 0/1) or for an attribute which could support any value or no value at all…
Its works as far as I tried but Is there a reason to not do that?


Nicolas
Follow me on Twitter and GitHub!
Multiple edits are usually to correct my frenglish…

Offline

#2 2016-06-01 10:55:48

NicolasGraph
Plugin Author
From: France
Registered: 2008-07-24
Posts: 860
Website

Re: An attribute without any value

In fact the case where it works seems to be an exception and I can’t make it works with other attributes… Does anyone already try this kind of thing?


Nicolas
Follow me on Twitter and GitHub!
Multiple edits are usually to correct my frenglish…

Offline

#3 2016-06-01 18:05:08

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,011
Website GitHub Mastodon Twitter

Re: An attribute without any value

Hi Nicolas,

Never tried it but I think that you could get a more informed input if you could post some code.


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#4 2016-06-01 19:11:54

NicolasGraph
Plugin Author
From: France
Registered: 2008-07-24
Posts: 860
Website

Re: An attribute without any value

colak wrote #299393:

Hi Nicolas,

Never tried it but I think that you could get a more informed input if you could post some code.

In fact you can take what ever plugin code which use an attribute as a switch, or even the plugin template, my code has nothing special; but I don’t think that it is possible to do what I tried because of the way attributes are built with latts(). I did what I wanted in a more usual way.


Nicolas
Follow me on Twitter and GitHub!
Multiple edits are usually to correct my frenglish…

Offline

#5 2016-06-02 07:54:19

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

Re: An attribute without any value

NicolasGraph wrote #299395:

I don’t think that it is possible to do what I tried because of the way attributes are built with latts().

Hi Nicolas, not sure to understand, could you be more specific?

Offline

#6 2016-06-02 08:17:14

NicolasGraph
Plugin Author
From: France
Registered: 2008-07-24
Posts: 860
Website

Re: An attribute without any value

etc wrote #299403:

Hi Nicolas, not sure to understand, could you be more specific?

I was working on an improved version of oui_cookie for Txp 4.6 only; I have a display attribute which is a simple switch like there are in other plugins and I thought it could be nice to be able to do that: <txp:oui_cookie value="my_cookie" display /> instead of <txp:oui_cookie value="my_cookie" display="1" /> but I can’t make it work properly. Doesn’t latts() require a value for each attribute?


Nicolas
Follow me on Twitter and GitHub!
Multiple edits are usually to correct my frenglish…

Offline

#7 2016-06-02 08:30:31

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

Re: An attribute without any value

NicolasGraph wrote #299404:

Doesn’t latts() require a value for each attribute?

No, it’s parse() that does not detect <txp:oui_cookie value="my_cookie" display /> as txp tag. It (currently) needs attr="value" pairs. That could be modified, but would be invalid (?) XML-wise.

Offline

#8 2016-06-02 09:18:08

NicolasGraph
Plugin Author
From: France
Registered: 2008-07-24
Posts: 860
Website

Re: An attribute without any value

etc wrote #299405:

No, it’s parse() that does not detect…

Oh, ok; good to know.

That could be modified, but would be invalid (?) XML-wise.

That’s where I’m starting to get lost; I don’t know XML a lot.
Edit: I think it is what you talk about?

Last edited by NicolasGraph (2016-06-02 09:32:18)


Nicolas
Follow me on Twitter and GitHub!
Multiple edits are usually to correct my frenglish…

Offline

Board footer

Powered by FluxBB