summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Lange <code@nerdmind.de>2017-04-27 12:27:48 +0200
committerThomas Lange <code@nerdmind.de>2017-04-27 12:27:48 +0200
commit0f851ff74109582a5ba111de3d3ebde78abe83d1 (patch)
treef233b74c0a65a74f5efcb3049142effd75067891
parenta05ec4c805c5f0334855d171e988466858d3835d (diff)
downloadwiki-0f851ff74109582a5ba111de3d3ebde78abe83d1.tar.gz
wiki-0f851ff74109582a5ba111de3d3ebde78abe83d1.tar.xz
wiki-0f851ff74109582a5ba111de3d3ebde78abe83d1.zip
Formatting changed.
-rw-r--r--Arguments.md6
1 files changed, 4 insertions, 2 deletions
diff --git a/Arguments.md b/Arguments.md
index da26303..7fe781d 100644
--- a/Arguments.md
+++ b/Arguments.md
@@ -3,7 +3,7 @@ This document explains how to use the optional field for arguments in the conten
## 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']`:
-### Unparsed: `$POST['ATTR']['ARGV']`:
+### Unparsed: `$POST['ATTR']['ARGV']`
string(32) "HIGHLIGHT|PREVIEW_IMG=foobar.png"
### Parsed: `$POST['ARGV']`
@@ -15,7 +15,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 in 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). 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:
+If you are a template developer, you can check in 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).
+
+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:
<?php if(isset($POST['ARGV']['PREVIEW_IMG'])): ?>
<img class="preview-img" href="<?=Application::getFileURL("images/preview/{$POST['ARGV']['PREVIEW_IMG']}")?>" alt="" />