Talk:Forms
From Organic Design wiki
<!-- Create a new element in the article's properties for our data -->
<input type="hidden" name="xpath:/properties:example" />
- this is really confusing to me. is this a temporary change? when i look at properties for this article, it shows default (none)? Phalseid 08:40, 19 Apr 2006 (NZST)
Email from aran@organicdesign.co.nz, Gir 09:10, 19 Apr 2006 (NZST)
Some notes from Peder's questions
- When a form or query-string name starts with "xpath:" xmlwiki realises that
- it is a value that needs to be sent directly into the article's properties
- (when I say properties, I'm meaning the same properties as when you click on
- the properties button of an article). The portion of the name following
- xpath: is a string of the XPath Query language which is kind of like SQL for
- XML structures. XPath queries allow you to navigate xml trees and select or
- create various elements or attributes etc
- And as you know, article properties are XML (at runtime XML is not text, but
- an object tree called a DOM object which can be manipulated with XPath
- queries and things and then save back to file or db as XML-text again)
- So in short the xpath: naming mechanism allows you to manipulate an articles
- properties directly from a posted form or query string.
- In xmlwiki the life of the properties is:
- 1. The properties starts as a copy of default-properties.xml
- 2. Its converted from text into a DOM object
- 3. Xml:Article is read, DOMificated and merged with properties-DOM
- 4. query-string and posted data is parsed and all XPath items are merged
- with properties-DOM
- Xpath answers:
- placing "title" with value "foo" in a form posted to index.php is no
- fancy XML/Xpath, its just like posting the form to index.php?title=foo
- "xpath:/properties:data" with value "foo.php" is like editing the
- properties and adding foo.php (making foo.php execute after
- $article is filled from db, but before wiki-parsing). <view> event happens
- after wikiparsing so $article is html by then not raw-wikitext. (there's
- also <save> and <edit> events, but don't worry about them for now)
- "xpath:/properties:example" with no value creates a new empty <example/>
- element in properties ready to be filled with other stuff specific to the
- example (done so the properties root doesn't get messed up with specifics).
- The data is obtained at runtime using xwGetProperty which gets it out of
- the articles properties DOM object.