📄 layout_html.inc
字号:
function beg_table ($a='') { $WIDTH=$a[WIDTH]; $BORDER=$a[BORDER]; $CELLPADDING=$a[CELLPADDING]; $CELLSPACING=$a[CELLSPACING]; $BGCOLOR=$a[BGCOLOR]; $ALIGN=$a[ALIGN]; $this->defval($WIDTH, $this->table_def['WIDTH']); $this->defval($BORDER, $this->table_def['BORDER']); $this->defval($CELLPADDING,$this->table_def['CELLPADDING']); $this->defval($CELLSPACING,$this->table_def['CELLSPACING']); $this->defval($BGCOLOR, $this->table_def['BGCOLOR']); $this->defval($ALIGN, $this->table_def['ALIGN']); $r=''; $r.=o_iftrue($WIDTH, $this->table['WIDTH']); $r.=(0<=$BORDER) ? sprintf($this->table['BORDER'],$BORDER) : ''; $r.=(0<=$CELLPADDING) ? sprintf($this->table['CELLPADDING'],$CELLPADDING) : ''; $r.=(0<=$CELLSPACING) ? sprintf($this->table['CELLSPACING'],$CELLSPACING) : ''; $r.=o_iftrue($BGCOLOR, $this->table['BGCOLOR']); $r.=o_iftrue($ALIGN, $this->table['ALIGN']); $out=sprintf($this->table['tabletag'],$r); $this->_debug('beg_table',$out); return($out); } function end_table () { $this->_debug2('end_table'); return($this->table['endtable']); } ## ---------------------------------------------- TABROW function doc_tabrow ($CONTENT) { $this->_debug2('doc_tabrow'); return("$CONTENT\n"); } function beg_tabrow ($a='') { $ALIGN=$a[ALIGN]; $VALIGN=$a[VALIGN]; $BGCOLOR=$a[BGCOLOR]; $this->defval($ALIGN, $this->tabrow_def['ALIGN']); $this->defval($VALIGN, $this->tabrow_def['VALIGN']); $this->defval($BGCOLOR, $this->tabrow_def['BGCOLOR']); $r=''; $r.=o_iftrue($ALIGN, $this->tabrow['ALIGN']); $r.=o_iftrue($VALIGN, $this->tabrow['VALIGN']); $r.=o_iftrue($BGCOLOR, $this->tabrow['BGCOLOR']); $out=sprintf($this->tabrow['trtag'],$r); $this->_debug('beg_tabrow',$out); return($out); } function end_tabrow () { $this->_debug2('end_tabrow'); return($this->tabrow['endtrtag']); } ## ---------------------------------------------- TABCELL function doc_tabcell ($CONTENT) { $this->_debug2('doc_tabcell'); return("\n$CONTENT"); } function beg_tabcell ($a='') { $COLSPAN=$a[COLSPAN]; $ROWSPAN=$a[ROWSPAN]; $ALIGN=$a[ALIGN]; $VALIGN=$a[VALIGN]; $BGCOLOR=$a[BGCOLOR]; $WIDTH=$a[WIDTH]; $this->defval($COLSPAN, $this->tabcell_def['COLSPAN']); $this->defval($ROWSPAN, $this->tabcell_def['ROWSPAN']); $this->defval($ALIGN, $this->tabcell_def['ALIGN']); $this->defval($VALIGN, $this->tabcell_def['VALIGN']); $this->defval($BGCOLOR, $this->tabcell_def['BGCOLOR']); $this->defval($WIDTH, $this->tabcell_def['WIDTH']); if ($COLSPAN==1) { $COLSPAN = false; } if ($ROWSPAN==1) { $ROWSPAN = false; } $r=''; $r.=o_iftrue($COLSPAN, $this->tabcell['COLSPAN']); $r.=o_iftrue($ROWSPAN, $this->tabcell['ROWSPAN']); $r.=o_iftrue($ALIGN, $this->tabcell['ALIGN']); $r.=o_iftrue($VALIGN, $this->tabcell['VALIGN']); $r.=o_iftrue($BGCOLOR, $this->tabcell['BGCOLOR']); $r.=o_iftrue($WIDTH, $this->tabcell['WIDTH']); $out=sprintf($this->tabcell['tdtag'],$r); $this->_debug('beg_tabcell',$out); return($out); } function end_tabcell () { $this->_debug2('end_tabcell'); return($this->tabcell['endtdtag']); } ## ---------------------------------------------- ULIST function doc_ulist ($CONTENT) { $this->_debug2('doc_ulist'); return("$CONTENT\n"); } function beg_ulist ($COMPACT='',$STYLE='',$CELLSPACING='') { $this->defval($COMPACT, $this->ulist_def['COMPACT']); $this->defval($STYLE, $this->ulist_def['STYLE']); $this->defval($CELLSPACING,$this->ulist_def['CELLSPACING']); $r=''; $r.=o_iftrue($COMPACT, $this->ulist['COMPACT']); $r.=o_iftrue($STYLE, $this->ulist['STYLE']); $r.=o_iftrue($CELLSPACING,$this->ulist['CELLSPACING']); $out=sprintf($this->ulist['ultag'],$r); $this->_debug('beg_ulist',$out); return($out); } function end_ulist () { $this->_debug2('end_ulist'); return($this->ulist['endultag']); } function ulistitem ($CONTENT,$IMGSRC='') { $this->defval($IMGSRC, $this->uitem_def['IMGSRC']); $r=sprintf($this->uitem['licont'],$CONTENT); $r=sprintf($r, $this->doc_pic(ARRAY( SRC=>$IMGSRC, HVSPACE=>'NULL'))); $this->_debug('ulistitem',$r); return( sprintf($this->uitem['litag'],$r) ); } ## ---------------------------------------------------- ANKER ## ANKER called with NO HREF is just simple text function doc_anker ($a) { $comment=$a[comment]; $HREF=$a[HREF]; $atext=$a[atext]; $TARGET=$a[TARGET]; $onclick=$a[onclick]; if ($HREF || $HREF=='NULL') { if ($HREF=='NULL') $HREF=''; $this->defval($comment, $this->anker_def['comment']); $this->defval($atext, $this->anker_def['atext']); $out=sprintf($this->anker['anker'], o_iftrue($comment, $this->anker['comment']), sprintf($this->anker['HREF'],$HREF) . o_iftrue($TARGET, $this->anker[TARGET]). o_iftrue($onclick, $this->anker[onclick]), o_iftrue($atext, $this->anker['atext']) ); } else { $out=o_iftrue($comment, $this->anker['comment']). o_iftrue($atext, $this->anker['atext']); } $this->_debug('doc_anker',$out); return($out); } ## ---------------------------------------------- PICTURE ## MISSING: - better handling of absolute and relative pathes ## - Handling of pictures, which are not existing on this ## server (hm, this is difficult!) function doc_pic ($a,$showdetails=false,$force=false) { GLOBAL $DOCUMENT_ROOT; $SRC=$a[SRC]; $path=$a[path]; $HREF=$a[HREF]; $BORDER=$a[BORDER]; $ALIGN=$a[ALIGN]; $HVSPACE=$a[HVSPACE]; $ALT=$a[ALT]; $WIDTH=$a[WIDTH]; $HEIGHT=$a[HEIGHT]; if (''==$SRC) { if ($showdetails) { $this->_debug2('doc_pic'); return("Kein Bild"); } else { $this->_debug2('doc_pic'); return(''); } } if (''==$path) { $path=$SRC; } if (ereg("^/",$SRC)) { ## if unset, assume $DOCUMENT_ROOT to be the path if (!$this->layoutpath) { $this->layoutpath=$GLOBALS[DOCUMENT_ROOT]; } $SRC= $this->layouturl . $SRC; $path=$this->layoutpath . $path; } if (file_exists($path)) { $WH=GetImageSize($path); } else { $this->defval($force, $this->picture_def['force']); if (!$force) { $this->_debug2('doc_pic not found'); return("Bild: '$path' nicht vorhanden!"); } } if ($WIDTH>0) { $WH[0]=$WIDTH; } if ($HEIGHT>0) { $WH[1]=$HEIGHT; } $this->defval($BORDER, $this->picture_def['BORDER']); $this->defval($ALIGN, $this->picture_def['ALIGN']); $this->defval(&$HVSPACE, $this->picture_def['HVSPACE']); $this->defval($ALT, $this->picture_def['ALT']); $r.=($BORDER!='') ? sprintf($this->picture['BORDER'],$BORDER) : ''; $r.=o_iftrue($ALIGN, $this->picture['ALIGN']); if ($HVSPACE) { $r.=sprintf($this->picture['HVSPACE'],$HVSPACE,$HVSPACE); } $r.=sprintf($this->picture['ALT'],HTMLSpecialChars($ALT)); $r.=sprintf($this->picture['WIDTH'],$WH[0]); $r.=sprintf($this->picture['HEIGHT'],$WH[1]); $out=sprintf($this->picture['pictag'],$SRC,$r); if ($HREF) { $out=$this->doc_anker('NULL',$HREF,$out); } if ($showdetails) { $name=ereg_Replace("^.*/","",$SRC); $out="<SMALL>'<B>$name</B>' ". "$WH[0]x$WH[1] Pixel</SMALL>\n$out"; } $this->_debug('doc_pic',$out); return($out); } ## -------------------------------------------------- SIMPTEXT ## function simptex ($a) { $text=$a[text]; $thead=$a[thead]; $theadsize=$a[theadsize]; $ALIGN=$a[ALIGN]; $this->defval($theadsize, $this->simptext_def['theadsize']); $this->defval($ALIGN, $this->simptext_def['ALIGN']); $r='';$r2=''; $r2.=o_iftrue($thead, sprintf($this->simptext['thead'], $theadsize,'%s',$theadsize) ); $r2.=sprintf($this->simptext['text'],$text); if ($ALIGN) { $r.=sprintf($this->simptext['ALIGN'],$ALIGN); $r.=$r2; $r.=$this->simptext['ENDALIGN']; } else { $r.=$r2; } $this->_debug('simptex',$r); return($r); } ## -------------------------------------------------- RULER function rula ($WIDTH='',$SIZE='',$NOSHADE='') { $this->defval($WIDTH, $this->ruler_def['WIDTH']); $this->defval($SIZE, $this->ruler_def['SIZE']); $this->defval($NOSHADE, $this->ruler_def['NOSHADE']); $this->defval($SRC, $this->ruler_def['SRC']); $r.=sprintf($this->ruler['SRC'],$SRC); $r.=o_iftrue($WIDTH, $this->ruler['WIDTH']); $r.=o_iftrue($SIZE, $this->ruler['SIZE']); $r.=o_iftrue($NOSHADE, $this->ruler['NOSHADE']); $out=sprintf($this->ruler['ruler'], $r); return($out); } ## -------------------------------------------------- PLACEHOLDER function placeholder ($WIDTH=1,$HEIGHT=1) { $this->_debug2('placeholder'); return($this->doc_pic(ARRAY( SRC=>$this->placeholder_def['SRC'], WIDTH=>$WIDTH, HEIGHT=>$HEIGHT)) ); } ## -------------------------------------------------- DOC_JAVASCRIPT function doc_javascript($js) { $out="<SCRIPT LANGUAGE=\"javascript\"><!--$js// --></SCRIPT>"; $this->_debug('doc_javascript',$out); return($out); } ## -------------------------------------------------- BOX_UPHD ## Box with headings at the top of box function box_uphd ($a) { $text=$a[text]; $thead=$a[thead]; $BOXCOLOR=$a[BOXCOLOR]; $ALIGN=$a[ALIGN]; $theadalign=$a[theadalign]; $INCOLOR=$a[INCOLOR]; $this->defval($ALIGN, $this->simptext_def['ALIGN']); $this->defval($theadalign, $this->simptext_def['ALIGN']); $this->defval($BOXCOLOR, $this->color_def['color2']); $this->defval($INCOLOR, $this->color_def['color1']); $this->_debug2('box_uphd'); return( $this->doc_table( $this->beg_table(ARRAY( WIDTH=>'NULL', CELLPADDING=>2, BGCOLOR=>$BOXCOLOR)). $this->doc_tabrow( $this->beg_tabrow(). $this->doc_tabcell( $this->beg_tabcell(ARRAY(ALIGN=>$theadalign)). $this->simptex(ARRAY( text=>$this->box_def[BOXPREHEAD].$thead, ALIGN=>$theadalign)). $this->end_tabcell() ). $this->end_tabrow(). $this->beg_tabrow(). $this->doc_tabcell( $this->beg_tabcell(ARRAY( ALIGN=>$theadalign)). $this->doc_table( $this->beg_table (ARRAY( WIDTH=>'100%', CELLPADDING=>5, BGCOLOR=>$INCOLOR)). $this->doc_tabrow( $this->beg_tabrow(). $this->doc_tabcell( $this->beg_tabcell(ARRAY( ALIGN=>$ALIGN)). $this->simptex(ARRAY( text=>$text)). $this->end_tabcell() ). $this->end_tabrow() ). $this->end_table() ). $this->end_tabcell() ). $this->end_tabrow() ). $this->end_table() )); } ######################################################### ## This function looks if $val is empty. ## if yes it returns the $default_val ## Special Rule: If $val == "NULL" then it returns an empty string ## After this $val is searched for a string like ## "%hugo[bla]%". If it is like this, it is replaced with ## $this->hugo[bla] ## IDEA: The last replacement could be done recursive ## ## Attention: $val is called by value! ## function defval (&$val,$default_val) { if (!isset($val) || ''==$val) { $val=$default_val; } elseif ('NULL' == $val) { $val=''; } if (ereg("^%([^\[]+)\[(.+)\]%$",$val,$regs) ) { $val=$this->{$regs[1]}[$regs[2]]; } } function _debug ($fnname,&$val) { if ($this->Debug) { echo "<B>$fnname</B>:<BR><TT>". nl2br(HTMLSpecialChars($val)) . "</TT><BR>"; } } function _debug2 ($fnname) { if ($this->Debug) { echo "<B>$fname</B><BR>"; } }} ?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -