summaryrefslogtreecommitdiffstats
path: root/Arguments.md
diff options
context:
space:
mode:
authorThomas Lange <code@nerdmind.de>2021-05-21 15:49:05 +0200
committerThomas Lange <code@nerdmind.de>2021-05-21 15:49:05 +0200
commit923a14c764a7f5939f74bd284b7d1f92df781ca2 (patch)
treeb19373dc89f9e1e20cb184cfabf5c770d41c42c9 /Arguments.md
parentd7fa3b949171785c8efb130cd2e90daf33f02c1a (diff)
downloadwiki-923a14c764a7f5939f74bd284b7d1f92df781ca2.tar.gz
wiki-923a14c764a7f5939f74bd284b7d1f92df781ca2.tar.xz
wiki-923a14c764a7f5939f74bd284b7d1f92df781ca2.zip
Optimize text
Diffstat (limited to 'Arguments.md')
-rw-r--r--Arguments.md12
1 files changed, 7 insertions, 5 deletions
diff --git a/Arguments.md b/Arguments.md
index 53edfce..6e00feb 100644
--- a/Arguments.md
+++ b/Arguments.md
@@ -1,7 +1,9 @@
-This document explains how to use the optional field for arguments in the content editor. This field can contain a list of arguments as key or key/value pairs formatted as follows: `FOO=value|BAR=value` (or `FOO=value|BAR`; `BAR` will be automatically set to `TRUE`).
+This document explains how to use the optional field for arguments in the content editor. This field can contain a list of arguments as key or key/value pairs formatted as follows:
+
+`FOO=value|BAR=value` (or `FOO=value|BAR`; `BAR` will be automatically set to `TRUE`).
## How to access arguments in a template
-Lets assume that your argument string for a specific post is something like this: `HIGHLIGHT|PREVIEW_IMG=foobar.png`. You can now access the entire (unparsed) argument string in templates by `$POST['ATTR']['ARGV']` (see template documentation for further information). This contains the unparsed argument string as he was written in the content editor. You also can access an parsed version of the arguments as key->value array with `$POST['ARGV']`:
+Lets assume that your argument string for a specific post is something like this: `HIGHLIGHT|PREVIEW_IMG=foobar.png`. You can now access the entire (unparsed) argument string in templates with `$POST['ATTR']['ARGV']` (see template documentation for more information). This contains the unparsed argument string as he was written into the content editor. You also can access a parsed version of the arguments as key->value array with `$POST['ARGV']`:
### Unparsed: `$POST['ATTR']['ARGV']`
string(32) "HIGHLIGHT|PREVIEW_IMG=foobar.png"
@@ -15,9 +17,9 @@ Lets assume that your argument string for a specific post is something like this
}
## How this arguments can be used to do something special
-If you are a template developer, you can check within your templates if the argument `HIGHLIGHT` is present (arguments with no explicit value will be automatically set to `TRUE`). If true, you can highlight this post differently (if you have some "promo posts" or something: just check if this value is set and add an extra CSS class to your HTML markup which then will highlight your post).
+If you are a template developer, you can check within your templates if the argument `HIGHLIGHT` is present (arguments with no explicit value will be automatically set to boolean `TRUE`). If set, you can highlight this post differently. Just check if this value is set and add an extra CSS class to your HTML markup which then will highlight your post.
-You even can add an preview image functionality. What if you want to show an preview image for each post in the list? There is no core functionality to do this, but with the argument functionality you can do this very simple:
+You can even add an preview image functionality. Lets assume you want to show a preview image for each post in the list? There is no core functionality to do this, but with the argument functionality you can do this very simple:
<?php if(isset($POST['ARGV']['PREVIEW_IMG'])): ?>
<img class="preview-img" href="<?=Application::getFileURL("images/preview/{$POST['ARGV']['PREVIEW_IMG']}")?>" alt="" />
@@ -27,4 +29,4 @@ You even can add an preview image functionality. What if you want to show an pre
Each argument key (the part before the `=`) must only contain letters from `A-Z`, `a-z`, `0-9` and underscores (`_`)!
## Conclusion
-The use cases of the arguments are practically unlimited. Please note that the templates of the `default` theme are not using any arguments provided in the argument field. It is up to you whether you implement this in your own template to do something special or not! \ No newline at end of file
+The use cases of these arguments are practically unlimited. Please note that the templates of the `default` theme are not using any arguments provided in the argument field. It is up **to you** whether you implement this in your own template to do something special or not! \ No newline at end of file