File modules/template_engine/components/html/component_insert/InsertComponent.class.php

Last commit: Wed Oct 14 22:36:29 2020 +0200	Jan Dankert	Refactoring: Fixed the namespace in component classes, now the are able to be load by the standard autoloader.
1 <?php 2 3 namespace template_engine\components\html\component_insert; 4 5 use template_engine\components\html\Component; 6 use template_engine\element\CMSElement; 7 8 class InsertComponent extends Component 9 { 10 public $name; 11 public $url; 12 public $function; 13 14 public function createElement() 15 { 16 if ( $this->function ) 17 { 18 // JS-Function einbinden 19 $script = new CMSElement('script'); 20 $script->addAttribute('type','text/javascript')->addAttribute('name','JavaScript'); 21 $script->content( $this->function.'();' ); 22 23 return $script; 24 } 25 elseif ( $this->url ) 26 { 27 // IFrame 28 $iframe = new CMSElement('iframe'); 29 if ( $this->name ) 30 $iframe->addAttribute('name', $this->name); 31 if ( $this->url ) 32 $iframe->addAttribute('src' ,$this->url); 33 34 return $iframe; 35 } 36 else 37 return null; 38 } 39 }
Download modules/template_engine/components/html/component_insert/InsertComponent.class.php
History Wed, 14 Oct 2020 22:36:29 +0200 Jan Dankert Refactoring: Fixed the namespace in component classes, now the are able to be load by the standard autoloader. Wed, 14 Oct 2020 22:20:22 +0200 Jan Dankert Refactoring: Renamed component folders, because 'if' is no valid namespace fragment.