bgarrels / textpattern

Automatically exported from code.google.com/p/textpattern
0 stars 0 forks source link

'Inner' support for forms #15

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Today I was working on a new textpattern-based website and realized it 
would be very powerful if I could effectively parameterize a form.   I 
would use this in several places in my site design to create consistent 
wrapping of content, but with different content for different scenarios.

Effectively I would call a form which would provide the outer wrapping 
tags, but I could pass some inner (x)html content.

This is a super oversimplification, doesn't adequately document the use 
cases, but I was thinking of something like this:

Page contains:

<txp:output_form "myform">
     <li>list item1</li>
     <li>list item2</li>
</txp:output_form />

Where form "myform" is defined as:

<div class="container">
   <ol>
      <txp:inner />
   </ol>
</div>

Output would be:

<div class="container">
   <ol>
     <li>list item1</li>
     <li>list item2</li>
   </ol>
</div>

Original issue reported on code.google.com by mark.ericson on 12 Jul 2009 at 8:58

GoogleCodeExporter commented 9 years ago
Disclaimer: I'm not a TXP developer, just another TXP user.

I've seen something similar in Django, where you can create that kind of 
wrapping
estructures...
IMHO, they are a little cumbersome, although they prove useful.

This kind of idea could go in tandem with this proposal (also inspired in 
Django):
http://forum.textpattern.com/viewtopic.php?pid=178734

Original comment by mani...@gmail.com on 13 Jul 2009 at 2:16

GoogleCodeExporter commented 9 years ago
<txp:variable /> can be used to provide such functionality.

Original comment by r.wetzlmayr on 13 Jul 2009 at 5:58

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
This is analogous to the <r:yield> tag in Radiant. I agree it would be a useful 
addition. Although <txp:variable 
/> can be used to achieve this result, it is more cumbersome and requires 
naming the variable (which requires 
awareness of potential name collisions). So, although <txp:variable /> is a 
more general solution, this idea has 
merit as a more targeted solution to the specific problem of parameterizing 
forms.

Original comment by artag...@gmail.com on 13 Jul 2009 at 6:48

GoogleCodeExporter commented 9 years ago

Original comment by artag...@gmail.com on 16 Jul 2009 at 5:58

GoogleCodeExporter commented 9 years ago
hi artagesw,

not sure what means the new status ("Confirmed").
Will you be working on adding this as a new feature?

Maybe we can do some little more brainstorming on this, although no doubt you
probably grasped the whole concept (and how to implement it on a "textpatternish
way") better and clearer than me. 
The "paremeterizing" concept is unfamiliar for me

First, both wet and you says that <txp:variable /> can be used to provide such
functionality. 
Could you, please, share how to do it? 
This will certainly make things clearer to understand (even if a solution using
<txp:variable /> may be cumbersome).

Seconda, there is also this post on TXP forum:
http://forum.textpattern.com/viewtopic.php?id=31191

I think that FireFusion is suggesting some way to create variables directly from
<txp:output_form /> attributes, so to avoid the hassle of writing <txp:variable 
/>
somewhere (one line above?) the <txp:output_form />, so when the "outputted" 
form is
called, then the variable already exists and can be used as a switch inside the 
form.

In other words:

  <txp:variable name="foo" value="1" />
  <txp:output_form form="my_form" />

Form "my_form":

  <txp:if_variable name="foo" value="1">
  do this
  <txp:else />
  do that
  </txp:if_variable>

That may be seen as a little cumbersome, but at least, it currently works, and 
seems
it's somehow inline with the "textpatternish" way of doing things.

FireFusion may be suggesting something like

  <txp:output_form form="my_form" var="foo" value="1" />

to create txp:variables "on the fly".
That looks tidier... but then, it may open a can of worms and questions and
suggestions ("let's add this to every TXP tag!").

I don't like this last example too much.

But, both examples could lead to another attempt to create a "One form to rule 
them
all", where just one form with lot of conditionals have every chunk of code on 
it...

Then, another idea: <txp:output_form> as a container tag, which may sound really
silly, as txp:output_form calls a form, so why would anyone want to use it as a
container tag?.  
Maybe, the contained stuff can only be one or some <txp:variable> and can act 
like
parameters on functions (parameterizing?). But being wrapped by 
txp:output_form, this
variables will only work inside the called form (and then, destroyed), so to 
avoid
name collisions?.

This can also lead to the "one form to rule them all" approach.

Anyway, I'm just thinking loud. I'm not a programmer and I'm probably be 
talking of
obvious things that you already considered.

Original comment by julian.l...@gmail.com on 16 Jul 2009 at 1:03

GoogleCodeExporter commented 9 years ago
"FireFusion may be suggesting something like

  <txp:output_form form="my_form" var="foo" value="1" />"

Actually it would be more like this.

<txp:output_form form="my_form" var_name="value" />

That way you could define many variables in one output form.

<txp:output_form form="my_form" var_name="value"  var_name2="value" 
var_name3="value" />

Original comment by robinpel...@gmail.com on 16 Jul 2009 at 3:28

GoogleCodeExporter commented 9 years ago
@julian:  "Confirmed" status means the proposed feature has been recognized as 
having merit and has been 
accepted (though not necessarily scheduled) for future implementation.

Original comment by artag...@gmail.com on 16 Jul 2009 at 6:15

GoogleCodeExporter commented 9 years ago
This issue was closed by r3251.

Original comment by artag...@gmail.com on 18 Jul 2009 at 8:16

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Hi Sam,

after doing some testing of this new feature (txp:output_form as container and
txp:yield) I've some ideas and comments to share with you and the TXP team.
Also, I've been already informed about a txp:scope thing on the pipeline ;) 
that may
come in handy, although at a first glance (must admit I didn't go into the 
details of
txp:scope and its usage) I ask if we really need another tag for managing the 
scope
of TXP variables (something that is, without any doubt, desirable) or if we may 
come
up with other alternative.

But before going on, I would like to know if this is the place to discuss it, or
should I do it on TXP forum, on a new issue or maybe joining a mailing list.

Thanks.

Original comment by mani...@gmail.com on 25 Aug 2009 at 12:33

GoogleCodeExporter commented 9 years ago
Well, since this issue has been closed, I think it would be better to discuss 
related ideas in a forum post or on 
the txp-dev mailing list.

Original comment by artag...@gmail.com on 25 Aug 2009 at 12:53

GoogleCodeExporter commented 9 years ago

Original comment by r.wetzlmayr on 9 Mar 2010 at 11:32