Droplet [[fieldcheck]] for validating Optionfield items

Stefek

Very good Idea, Martin.

Brings some logic into modules 'Layout Fields'.

*thumbsup*

Regards,
Stefek
[i]"Gemeinsam schafft man mehr."[/i]

[b][url=http://duden.de/rechtschreibung/gemeinsam#Bedeutung1]gemeinsam[/url][/b]
1. mehreren Personen oder Dingen in gleicher Weise gehörend, eigen
2. in Gemeinschaft [unternommen, zu bewältigen]; zusammen, miteinander
#Duden

mr-fan

hi,

i haven't contributed some little pieces for a long time so here is a little droplet for checking field in Options from Newsmodule or Topics in my example:

Dropletname: fieldcheck

Code:


<?php //only for color dont copy
if (isset($field) and $feld != '') {
  if (isset(
$name)) {
      
$output '<strong>'.$name.'</strong>: '.$feld;   //maybe other output is wanted here
  
}else{
      
$output $feld;
  }
}else{
 
$output '&nbsp;';
}

return 
$output;


Examplecall: [[fieldcheck?field=[SHORT_DESCRIPTION]&name=Shorttext]]

Output would be like      "shorttext: Short_description"

example from Topics Options:
<h3 class="tp_headline_termine">{TITLE}</h3>
<p>[[fieldcheck?field=[SHORT_DESCRIPTION]&name=Was]]
[[fieldcheck?field=[XTRA2]&name=Wo]]
[[fieldcheck?field=[XTRA3]&name=Hinweise]]</p>
[EDITLINK]


If the field is empty (like in Topics some XTRA fields) no output would be created or you could set a default output...

only a little piece of code btu mybe helpfully.

best regards

martin