Vorlage:BasePanel: Unterschied zwischen den Versionen

Aus Afterbuy-Wiki
Wechseln zu:Navigation, Suche
Zeile 1: Zeile 1:
<div class="{{#switch: {{{type|info}}} | info=alert-info | tip=alert-success | warning=alert-danger | example=bg-light | quote=bg-light text-muted | alert-info }} p-1 mx-0 my-3 shadow-sm" style="{{#ifeq: {{{type|info}}} | quote | border-left: 6px solid #ddd;}}"><table class="p-0 m-0">{{#ifeq: {{{type|info}}} | example |<tr><td width="100%" class="mx-2 px-2 mb-2"><span class="badge badge-secondary">Beispiel</span></td></tr><tr><td width="100%" class="mx-2 px-2">{{{text|informations}}}</td></tr>|<tr><td width="1%" class="mx-2 px-2"><i class="{{#switch: {{{type|info}}} | info = fas fa-info-circle | tip = fas fa-lightbulb | warning = fas fa-exclamation-circle}}  "></i></td><td width="100%">{{{text|informations}}}</td></tr> }} </table></div>
+
<phptag>
 +
if(is_array($argv) && !empty($argv)){
 +
array_shift($argv);
 +
$text='informations';
 +
if(isset($argv['text']) && trim($argv['text'])!=""){
 +
$text=trim($argv['text']);
 +
}
 +
$type='info';
 +
if(isset($argv['type']) && trim($argv['type'])!=""){
 +
$type=trim($argv['type']);
 +
}
 +
$icon='';
 +
$class='';
 +
$style='';
 +
 +
if ($type=='info'){
 +
$class='alert-info';
 +
$icon='fas fa-info-circle';
 +
} else if ($type=='tip'){
 +
$class='alert-success';
 +
$icon='fas fa-lightbulb';
 +
} else if ($type=='warning'){
 +
$class='alert-danger';
 +
$icon='fas fa-exclamation-circle';
 +
} else if ($type=='example'){
 +
$class='bg-light';
 +
} else if ($type=='quote'){
 +
$class='bg-light text-muted';
 +
$style='border-left: 6px solid #ddd;';
 +
}
 +
 
 +
$out='<div class="'.$class.' p-1 mx-0 my-3 shadow-sm" style="'.$style.'"><table class="p-0 m-0"><tr>';
 +
if($type=='example'){
 +
$out.='<td width="100%" class="mx-2 px-2 mb-2"><span class="badge badge-secondary">Beispiel</span></td></tr><tr>';
 +
} else {
 +
if($icon!=""){
 +
$out.='<td width="1%" class="mx-2 px-2" valign="top"><i class="'.$icon.'"></i></td>';
 +
}
 +
}
 +
$out.='<td width="100%" class="mx-2 px-2">'.$text.'</td></tr></table></div>';
 +
echo $out;
 +
}
 +
</phptag>

Version vom 16. April 2021, 09:20 Uhr

informations