当前位置: 首页>>代码示例>>PHP>>正文


PHP HtmlElement::AddChild方法代码示例

本文整理汇总了PHP中HtmlElement::AddChild方法的典型用法代码示例。如果您正苦于以下问题:PHP HtmlElement::AddChild方法的具体用法?PHP HtmlElement::AddChild怎么用?PHP HtmlElement::AddChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HtmlElement的用法示例。


在下文中一共展示了HtmlElement::AddChild方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 /**
  * A widget containing a line of user inputs for a form element
  * @param string $name The HTML name (and #id) of the input element(s) and label
  * @param string $title The text written next to the input element(s)
  * @param string $inputs The input element(s) for the form line
  **/
 public function __construct($name, $title, $inputs)
 {
     parent::__construct('div', array('class' => 'formline'));
     // Add the label
     $this->AddContainer(new HtmlElement('label', array('for' => $name), $title), 'LABEL');
     // Create the input group
     $group = new HtmlElement('div', array('class' => 'formgroup'));
     if (is_a($inputs, 'HtmlElement')) {
         $group->AddChild($inputs);
     } elseif (RTK::ArrayIsLongerThan($array, 0)) {
         foreach ($inputs as $input) {
             if (is_a($input, 'HtmlElement')) {
                 $group->AddChild($input);
             }
         }
     }
     $this->AddContainer($group, 'GROUP');
     // Add the error section
     $this->AddContainer(new HtmlElement(), 'ERROR');
 }
开发者ID:iensenfirippu,项目名称:RTK,代码行数:26,代码来源:formline.php

示例2: TraverseComment

 /**
  * Recursively traverses the tree of comments and builds the markup accordingly
  * @param HtmlElement $box the box to put the resulting markup into
  * @param Comment[] $comments the comments for the current recursion
  **/
 private function TraverseComment(&$box, $comments)
 {
     if (sizeof($comments) > 0) {
         foreach ($comments as $comment) {
             if (is_a($comment, 'Comment')) {
                 $args = null;
                 if (Login::IsLoggedIn()) {
                     $args = array('onclick' => 'SelectComment(' . $comment->GetId() . ')');
                 }
                 $childbox = new RTK_Box($comment->GetId(), 'comment');
                 $infobox = new RTK_Box($comment->GetId(), 'commentinfo', $args);
                 $infobox->AddChild(new RTK_Textview($comment->GetUser()->GetUserName() . ':', true, null, 'commentposter'));
                 $infobox->AddChild(new RTK_Textview($comment->GetContents(), true, null, 'commentmessage'));
                 $infobox->AddChild(new RTK_Textview('Posted ' . $comment->GetTime(), true, null, 'commenttime'));
                 $childbox->AddChild($infobox);
                 if (!empty($comment->GetComments())) {
                     $this->TraverseComment($childbox, $comment->GetComments());
                 }
                 $box->AddChild($childbox);
             }
         }
     }
 }
开发者ID:iensenfirippu,项目名称:RTK,代码行数:28,代码来源:commentview.php

示例3: __tostring

 public function __tostring()
 {
     //$html = '<!doctype '.$this->_doctype.'>'.RTK_OUTPUTNEWLINE;
     $html = '<!doctype html>' . RTK_OUTPUTNEWLINE;
     // To make sure that stylesheets are always loaded in the same order (important for some rules), sort the stylesheet collection
     // TODO: This wont always be the preferable solution so a "weight" or "importance" system might need to be implemented
     sort($this->_stylesheets);
     if ($this->_favicon != null) {
         $this->AddElement(new HtmlElement('link', array('rel' => 'icon', 'type' => 'image/png', 'href' => $this->_favicon)), 'HEAD', 'FAVICON');
     }
     $this->AddElement(new HtmlElement('title', null, $this->_title), 'HEAD', 'TITLE');
     foreach ($this->_stylesheets as $stylesheet) {
         $this->_references['HEAD']->AddChild($stylesheet);
     }
     foreach ($this->_javascripts as $javascript) {
         $this->_references['HEAD']->AddChild($javascript);
     }
     $this->_stylesheets = array();
     $this->_javascripts = array();
     if (sizeof($this->_popups) > 0) {
         $popups = new HtmlElement('div', array('id' => 'Popups'));
         $popups->AddChild(new HtmlElement('script', array('language' => 'javascript'), 'function ClosePopup(divid) { var popups = document.getElementById(\'Popups\'); if (popups.children.length > 2) { var popup = document.getElementById(divid); popup.parentNode.removeChild(popup); } else { popups.parentNode.removeChild(popups); } }'));
         foreach ($this->_popups as $popup) {
             $popups->AddChild($popup);
         }
         $this->_references['BODY']->AddChild($popups, 0);
     }
     $newline = false;
     foreach ($this->_elements as $HtmlElement) {
         if ($newline) {
             $html .= OUTPUTNEWLINE;
         } else {
             $newline = true;
         }
         $html .= $HtmlElement;
     }
     return $html;
 }
开发者ID:iensenfirippu,项目名称:RTK,代码行数:38,代码来源:htmldocument.php

示例4: AddElement

 /**
  * Add a custom HtmlElement into the form (not recommended)
  * @param string $name The name/id of the element
  * @param string $title The text written on the element
  * @param HtmlElement $HtmlElement The element to add
  * @param HtmlElement $container (optional) The "container" to add it to
  **/
 public function AddElement($name, $title, $htmlelement, $container = null)
 {
     $field = new HtmlElement('div', array('class' => 'formline'));
     $field->AddChild(new HtmlElement('label', array('for' => $name), $title));
     $group = new HtmlElement('div', array('class' => 'formgroup'));
     $group->AddChild($htmlelement);
     $field->AddChild($group);
     $this->AddToContainer($field, $container);
 }
开发者ID:iensenfirippu,项目名称:securipe,代码行数:16,代码来源:Form.php

示例5: AppendRow

 /**
  * Appends a row to the listview
  * @param string[] $row The values to put into the row
  * @param integer $i The index of the row
  **/
 private function AppendRow($row, $i)
 {
     $line = new HtmlElement('tr', array('class' => $this->GetRowClass($i)));
     $rowsize = sizeof($row) - 1;
     for ($i = 0; $i <= $rowsize; $i++) {
         if (is_a($row[$i], 'HtmlElement')) {
             $line->AddChild(new HtmlElement('td', array('class' => $this->GetCellClass($i, $rowsize)), EMPTYSTRING, $row[$i]));
         } else {
             $line->AddChild(new HtmlElement('td', array('class' => $this->GetCellClass($i, $rowsize)), $row[$i]));
         }
     }
     //$this->AddChild($line);
     $this->AddToContainer($line, 'table');
 }
开发者ID:iensenfirippu,项目名称:securipe,代码行数:19,代码来源:Listview.php


注:本文中的HtmlElement::AddChild方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。