WebsiteBaker Logo
  • *
  • Templates
  • Help
  • Add-ons
  • Download
  • Home
*
Welcome, Guest. Please login or register.

Login with username, password and session length
 

News


WebsiteBaker 2.13.6 is now available!


Will it continue with WB? It goes on! | Geht es mit WB weiter? Es geht weiter!
https://forum.websitebaker.org/index.php/topic,32340.msg226702.html#msg226702


The forum email address board@websitebaker.org is working again
https://forum.websitebaker.org/index.php/topic,32358.0.html


R.I.P Dietmar (luisehahne) and thank you for all your valuable work for WB
https://forum.websitebaker.org/index.php/topic,32355.0.html


* Support WebsiteBaker

Your donations will help to:

  • Pay for our dedicated server
  • Pay for domain registration
  • and much more!

You can donate by clicking on the button below.


  • Home
  • Help
  • Search
  • Login
  • Register

  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • Droplets & Snippets »
  • Droplet [[fieldcheck]] for validating Optionfield items
  • Print
Pages: [1]   Go Down

Author Topic: Droplet [[fieldcheck]] for validating Optionfield items  (Read 5219 times)

mr-fan

  • Guest
Droplet [[fieldcheck]] for validating Optionfield items
« on: November 21, 2010, 08:39:57 PM »
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:

Code: [Select]
<?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:
Code: [Select]
<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


« Last Edit: April 18, 2013, 04:33:03 PM by mr-fan »
Logged

Offline Stefek

  • Posts: 6177
  • Gender: Male
  • ("ړ)
Re: Droplet [[fieldcheck]] for validating Optionfield items
« Reply #1 on: November 23, 2010, 03:36:11 PM »
Very good Idea, Martin.

Brings some logic into modules 'Layout Fields'.

*thumbsup*

Regards,
Stefek
Logged
"Gemeinsam schafft man mehr."

gemeinsam
1. mehreren Personen oder Dingen in gleicher Weise gehörend, eigen
2. in Gemeinschaft [unternommen, zu bewältigen]; zusammen, miteinander
#Duden

  • Print
Pages: [1]   Go Up
  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • Droplets & Snippets »
  • Droplet [[fieldcheck]] for validating Optionfield items
 

  • SMF 2.0.19 | SMF © 2017, Simple Machines
  • XHTML
  • RSS
  • WAP2