Einchecken des OnlineStands
This commit is contained in:
34
.classes/generic/renderWidgetClass.php
Normal file
34
.classes/generic/renderWidgetClass.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
class renderWidgetClass extends renderClass_abstract
|
||||
{
|
||||
|
||||
public function createWidget ( $widgetData )
|
||||
{
|
||||
$html = file_get_contents ( $this -> _pathTpl . $this -> _layout . '/tpl_' . $this -> _template . '_widget_' . $widgetData[ 'tpl' ] . '.php' );
|
||||
$html = str_replace ( $this -> _renderSearch , $this -> _renderReplace , $html );
|
||||
|
||||
foreach ( $widgetData as $key => $value )
|
||||
{
|
||||
$html = str_replace ( '%%' . $key . '%%' , $value , $html );
|
||||
}
|
||||
|
||||
$subTpl = new DOMDocument ( );
|
||||
$subTpl -> preserveWhitespace = false;
|
||||
$subTpl -> formatOutput = true;
|
||||
$subTpl -> loadHTML ( $html );
|
||||
|
||||
$xpath = new DOMXpath ( $subTpl );
|
||||
$subCont = $xpath -> query ( ".//*[contains(concat(' ', @class, ' '), ' " . $widgetData[ 'tpl' ] . " ')]" ) -> item( 0 );
|
||||
|
||||
if ( isset ( $widgetData[ 'id' ] ) )
|
||||
{
|
||||
$subCont -> setAttributeNode ( new DOMAttr ( 'id' , 'widget_' . $widgetData[ 'id' ] ) );
|
||||
}
|
||||
|
||||
$new_node = $this -> _tpl -> importNode ( $subCont , true );
|
||||
return $new_node;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user