Say I have an inputfield, named “test”, and it’s value is like this;
(title:foo item:bar)
Is there any option I can query / retrieve only the item key, with it’s value (and if even possible, without being wrapped in <p></p>).
I’ve tried several syntaxes, none of them worked - neither did I found a solution in the docs or forum.
echo $page->test("item")->text(); /* should return bar */
What is the purpose of this input field and why does it contain a kirbytag?
It renders something like
<p>read more about <b>bar</b></p>```
****
This works fine, but I need the value of **item** (*bar*) also in another element at that page;
****
```<blockquote>Glad to see you are interested in <i>bar</i>!< /blockquote>```
So when I'm able to query that specific *key* (**item**) and it's *value* (**bar**) it would help me out...
I’d write a function that extracts the “key” and “value” as substrings of the raw text.
If you need structured information, consider storing the information in a structured way. Kirbytext and its Kirbytags are supposed to be used in prose text, not to be converted into a structure again.
You can use two separate fields for that and then assemble the HTML in your templates.
I agree, I’d prefer that to extracting information from a text field.
Okay - so there is no default option
No problem - I already solved it by writing my own function…
I needed it for this “plugin” that show the rendertime of your Kirby php-page.