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


PHP HtmlElement::setContent方法代码示例

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


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

示例1: addOption

 public function addOption($value, $label, $properties = array())
 {
     $option = new HtmlElement(false, 'option', $properties);
     $option->setProperty('value', $value);
     $option->setContent($label);
     $this->html->setContent($option, $value);
 }
开发者ID:hjfigueira,项目名称:ActiveInterfaces,代码行数:7,代码来源:ActiveSelect.php

示例2: smarty_block_menuItem

/**
 * Smarty block plugin, for generating page menu item
 * This block must always be called in pageMenu block context
 *
 * @param array $params
 * @param Smarty $smarty
 * @param $repeat
 *
 * <code>
 *	{pageMenu id="menu"}
 *		{menuItem}
 *			{menuCaption}Click Me{/menuCaption}
 *			{menuAction}http://click.me.com{/menuAction} 
 *		{/menuItem}
 *		{menuItem}
 *			{menuCaption}Another menu item{/menuCaption}
 *			{pageAction}alert('Somebody clicked on me too!'){/menuAction} 
 *		{/menuItem}
 *  {/pageMenu}
 * </code>
 *
 * @package application.helper.smarty
 * @author Integry Systems
 */
function smarty_block_menuItem($params, $content, LiveCartSmarty $smarty, &$repeat)
{
    if ($repeat) {
        $smarty->clear_assign('menuCaption');
        $smarty->clear_assign('menuAction');
        $smarty->clear_assign('menuPageAction');
    } else {
        $item = new HtmlElement('a');
        if ($smarty->get_template_vars('menuAction')) {
            $href = $smarty->get_template_vars('menuAction');
        } else {
            if ($smarty->get_template_vars('menuPageAction')) {
                $onClick = $smarty->get_template_vars('menuPageAction');
                $href = '#';
                $item->setAttribute('onClick', $onClick . '; return false;');
            }
        }
        $item->setAttribute('href', $href);
        // EXPERIMENTAL - set access key for menu item
        $caption = $smarty->get_template_vars('menuCaption');
        if (FALSE != strpos($caption, '&&')) {
            $p = strpos($caption, '&&');
            $accessKey = substr($caption, $p + 2, 1);
            $item->setAttribute('accessKey', $accessKey);
            $caption = substr($caption, 0, $p + 3) . '</span>' . substr($caption, $p + 3);
            $caption = substr($caption, 0, $p) . '<span class="accessKey">' . substr($caption, $p + 2);
        }
        $item->setContent($caption);
        $smarty->append('pageMenuItems', $item->render());
    }
}
开发者ID:saiber,项目名称:www,代码行数:55,代码来源:block.menuItem.php

示例3: setLabel

 public function setLabel($label)
 {
     $labelElement = new HtmlElement(false, 'label');
     $labelElement->setProperty('for', $this->html->getProperty('name'));
     $labelElement->setContent($label);
     $this->label = $labelElement;
 }
开发者ID:hjfigueira,项目名称:ActiveInterfaces,代码行数:7,代码来源:ActiveElement.php

示例4: getData

 public function getData()
 {
     $listHtml = array('<ul>');
     $li = new HtmlElement('li');
     foreach ($this->content as $key => $value) {
         $li->setAttribute('id', $key);
         $li->setContent($value);
         $listHtml[] = $li->render();
     }
     $listHtml[] = '</ul>';
     return implode("\n", $listHtml);
 }
开发者ID:saiber,项目名称:www,代码行数:12,代码来源:AutoCompleteResponse.php

示例5: html

 function html($showErrors = false)
 {
     if (!$this->isContainer) {
         return parent::html($showErrors);
     }
     $elementsHtml = '';
     foreach ($this->elements as $e) {
         $elementsHtml .= $e->html() . Html::br();
     }
     parent::setContent($elementsHtml);
     return parent::html();
 }
开发者ID:simplef,项目名称:simpleframework,代码行数:12,代码来源:FormulaireElement.class.php

示例6: smarty_block_pageMenu

/**
 * Smarty block plugin, for generating page menus
 *
 * @param array $params
 * @param Smarty $smarty
 * @param $repeat
 *
 * <code>
 *	{pageMenu id="menu"}
 *		{menuItem}
 *			{menuCaption}Click Me{/menuCaption}
 *			{menuAction}http://click.me.com{/menuAction} 
 *		{/menuItem}
 *		{menuItem}
 *			{menuCaption}Another menu item{/menuCaption}
 *			{pageAction}alert('Somebody clicked on me too!'){/menuAction}
 *		{/menuItem}
 *  {/pageMenu}
 * </code>
 *
 * @return string Menu HTML code
 * @package application.helper.smarty
 * @author Integry Systems
 */
function smarty_block_pageMenu($params, $content, LiveCartSmarty $smarty, &$repeat)
{
    if ($repeat) {
        $smarty->clear_assign('pageMenuItems');
    } else {
        $items = $smarty->get_template_vars('pageMenuItems');
        $menuDiv = new HtmlElement('div');
        $menuDiv->setAttribute('id', $params['id']);
        $menuDiv->setAttribute('tabIndex', 1);
        $menuDiv->setContent(implode(' | ', $items));
        return $menuDiv->render();
    }
}
开发者ID:saiber,项目名称:www,代码行数:37,代码来源:block.pageMenu.php

示例7: setLabel

 public function setLabel($label)
 {
     $labelElement = new HtmlElement(false, 'legend');
     $labelElement->setContent($label);
     $this->html->setContent($labelElement, 'legend');
 }
开发者ID:hjfigueira,项目名称:ActiveInterfaces,代码行数:6,代码来源:ActiveFieldset.php

示例8: renderOuter

 /**
  * @return array
  */
 public function renderOuter() : array
 {
     HtmlElement::setContent('[-INNER-]');
     $render = HtmlElement::render();
     return explode('[-INNER-]', $render);
 }
开发者ID:cawaphp,项目名称:cawa,代码行数:9,代码来源:HtmlContainer.php

示例9: splitSource

 /**
  * Splits $this->source into elements.
  */
 public function splitSource()
 {
     $splitterRegexp = '@(\\{/?(?:' . $this->getSignaturesRegexp() . ').*?/?\\})@ims';
     $elementsRaw = preg_split($splitterRegexp, $this->source, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_OFFSET_CAPTURE | PREG_SPLIT_NO_EMPTY);
     /* @var $element Abstraction\ElementAbstraction */
     $this->elements = array();
     foreach ($elementsRaw as $rawElement) {
         $elementSource = $rawElement[0];
         $firstCharOfElementSource = $elementSource[0];
         $secondCharOfElementSource = strlen($elementSource) > 1 ? $elementSource[1] : null;
         $preLastCharOfElementSource = strlen($elementSource) > 2 ? $elementSource[strlen($elementSource) - 2] : null;
         $element = true;
         $signature = null;
         // If this is SupraMarkup element, try to extract signature from raw element, ...
         if ($firstCharOfElementSource == '{') {
             $signature = $this->extractSignature($elementSource);
         }
         if (!empty($signature)) {
             // create element from signature, ...
             $elementClassName = $this->markupElements[$signature];
             $element = new $elementClassName();
             if (!$element instanceof Abstraction\SupraMarkupElement) {
                 throw new Exception\RuntimeException(sprintf('Expecting element to be instance of SupraMarkupElement, [%s] received.', get_class($element)));
             }
             /* @var $element Abstraction\ElementAbstraction */
             if ($preLastCharOfElementSource == '/') {
                 // ... and if this is a standalone markup element - like {trololo.trololo /},
                 // create and initialize it.
                 $element->setSource($elementSource);
                 $element->parseSource();
             } else {
                 if ($secondCharOfElementSource == '/') {
                     // ... or if this this element is a closing part of a block,
                     // i.e. - begins with a slash, check if class of instace we
                     // created earlier actually is block constructor. If it is so,
                     // treat created element as block constructor and get block
                     // end element from it. Otherwise do nothing, skip this element.
                     if ($element instanceof Abstraction\SupraMarkupBlockConstructor) {
                         /* @var $element Abstraction\SupraMarkupBlockConstructor */
                         $element = $element->makeEnd();
                         $this->elements[] = $element;
                     }
                 } else {
                     // ... otherwise this looks like an opening part of a block. We check if
                     // instace of this element is subclass of SupraMarkupBlockConstructor, then proceed to
                     // fetch coresponding block start element. Otherwise use element already created. This is because
                     // there might be some errornous SupraMarkup cases when, for exampl {supra.image ...} does not
                     // have a slash in the end.
                     if ($element instanceof Abstraction\SupraMarkupBlockConstructor) {
                         /* @var $element Abstraction\SupraMarkupBlockConstructor */
                         $element = $element->makeStart();
                     }
                     $element->setSource($elementSource);
                     $element->parseSource();
                     $this->elements[] = $element;
                 }
             }
         } else {
             // If is just a piece of content (HTML), just create element and set it's content.
             $element = new HtmlElement();
             $element->setContent($elementSource);
             $this->elements[] = $element;
         }
     }
 }
开发者ID:sitesupra,项目名称:sitesupra,代码行数:68,代码来源:TokenizerAbstraction.php


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