summaryrefslogtreecommitdiffstats
path: root/Arguments.md
diff options
context:
space:
mode:
authorThomas Lange <code@nerdmind.de>2021-07-21 16:38:32 +0200
committerThomas Lange <code@nerdmind.de>2021-07-21 16:38:32 +0200
commit3110e98a7b1bbaecb37d3430983b7855a40a924d (patch)
tree613cb5e879524957d5285d3d6b6269bb1794a2ec /Arguments.md
parent14cf9d5e2181fadfae7f6c7a64f0a49f55760624 (diff)
downloadwiki-3110e98a7b1bbaecb37d3430983b7855a40a924d.tar.gz
wiki-3110e98a7b1bbaecb37d3430983b7855a40a924d.tar.xz
wiki-3110e98a7b1bbaecb37d3430983b7855a40a924d.zip
Do some minor optimizations
Diffstat (limited to 'Arguments.md')
-rw-r--r--Arguments.md10
1 files changed, 8 insertions, 2 deletions
diff --git a/Arguments.md b/Arguments.md
index 6e00feb..801adba 100644
--- a/Arguments.md
+++ b/Arguments.md
@@ -3,7 +3,13 @@ This document explains how to use the optional field for arguments in the conten
`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 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']`:
+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"
@@ -19,7 +25,7 @@ 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 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 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:
+You can even add a 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="" />