本文整理汇总了PHP中HtmlElement类的典型用法代码示例。如果您正苦于以下问题:PHP HtmlElement类的具体用法?PHP HtmlElement怎么用?PHP HtmlElement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了HtmlElement类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: addFormElementContainer
/**
* Add element of container that contains form element and caption
*
* @param HtmlElement $inputContainer
* @param HtmlElement $captionContainer
*/
protected function addFormElementContainer(HtmlElement $inputContainer, HtmlElement $captionContainer)
{
$div = new HtmlElement('div');
$div->addElement($captionContainer);
$div->addElement($inputContainer);
$this->addElement($div);
}
开发者ID:2626suke,项目名称:curryfw,代码行数:13,代码来源:form_layout_div.php
示例2: __construct
public function __construct($name, $options, $selectedValue = '', $type = self::TYPE_RADIO, $validator = null)
{
static::$instanceCount++;
HtmlElement::__construct('div');
$this->validator = $validator;
$this->type = $type;
$this->setAttribute('name', $name);
$selectedValues = array();
if ($type == self::TYPE_RADIO) {
$selectedValues = array($selectedValue);
} else {
$selectedValues = explode(',', $selectedValue);
}
$i = 0;
foreach ($options as $key => $value) {
$optionId = 'data-element-group-' . static::$instanceCount . '-' . $i;
$option = new HtmlElement('input');
$option->setAttribute('type', $this->type);
$option->setAttribute('name', $name);
$option->setAttribute('id', $optionId);
$option->setAttribute('value', $value);
if (in_array($key, $selectedValues)) {
$option->setAttribute('checked');
}
$label = new HtmlElement('label');
$label->setAttribute('for', $optionId);
$label->addChild(new TextElement($value));
$this->addChild($option);
$this->addChild($label);
$i++;
}
}
开发者ID:Cloudrexx,项目名称:cloudrexx,代码行数:32,代码来源:DataElementGroup.class.php
示例3: 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
示例4: __construct
/**
* A widget for displaying an image (img)
* @param string $imgurl The url of the image
* @param string $alttext A text that will be shown if the image could not be loaded
* @param boolean $forcehttps Specify if the link has to have https
* @param HtmlAttributes $args Allows custom html tag arguments to be specified (not recommended)
**/
public function __construct($imgurl = EMPTYSTRING, $alttext = '[IMG]', $args = null)
{
parent::__construct();
$img = new HtmlElement('img', $args);
$img->AddAttributes(array('src' => RTK::GetBaseURL() . $imgurl, 'alt' => $alttext));
$this->AddChild($img);
}
开发者ID:iensenfirippu,项目名称:RTK,代码行数:14,代码来源:image.php
示例5: addFormElementContainer
/**
* Add element of container that contains form element and caption
*
* @param HtmlElement $inputContainer
* @param HtmlElement $captionContainer
*/
protected function addFormElementContainer(HtmlElement $inputContainer, HtmlElement $captionContainer)
{
$container = new HtmlElement($this->_containerTagName);
$container->setClass($this->_containerClass);
$container->addElement($captionContainer);
$container->addElement($inputContainer);
$this->_parentForm->addElement($container);
}
开发者ID:2626suke,项目名称:curryfw,代码行数:14,代码来源:form_layout_standard.php
示例6: setLabel
function setLabel($label_text, $attributes = array())
{
$label = new HtmlElement('label', null, true);
$label->setAttribute('class', 'phaxsi_label');
$label->setAttributes($attributes);
$label->innerHTML = $label_text;
$this->label = $label;
}
开发者ID:RNKushwaha022,项目名称:orange-php,代码行数:8,代码来源:textlist.input.php
示例7: begin
public function begin()
{
echo $this->getElementOpenTag() . "\n";
$legend = new HtmlElement("legend");
$legend->setBody($this->title);
echo $legend;
$this->started = true;
}
开发者ID:fruition-sciences,项目名称:phpfw,代码行数:8,代码来源:Section.php
示例8: addFormElementContainer
/**
* Add element of container that contains form element and caption
*
* @param HtmlElement $inputContainer
* @param HtmlElement $captionContainer
*/
protected function addFormElementContainer(HtmlElement $inputContainer, HtmlElement $captionContainer)
{
if (!$this->_tbody instanceof HtmlElement) {
$this->_tbody = new HtmlElement('tbody');
$this->addElement($this->_tbody);
}
$tr = new HtmlElement('tr');
$tr->addElement($captionContainer);
$tr->addElement($inputContainer);
$this->_tbody->addElement($tr);
}
开发者ID:2626suke,项目名称:curryfw,代码行数:17,代码来源:form_layout_table.php
示例9: 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
示例10: tagShort
/**
* Shorten string if mor that max - and outputs span with original text in title
* @param int max | max length
* @container
*/
protected function tagShort($attrs)
{
$max = intval($attrs->max);
$string = trim($this->body());
$orig = $string;
if (strlen($string) > $max) {
$string = substr($string, 0, $max - 3) . '...';
}
$span = new HtmlElement('span', array('title' => $orig));
$span->addChild(new HtmlText($string));
return $span;
}
开发者ID:hofmeister,项目名称:Pimple,代码行数:17,代码来源:ValueTagLib.php
示例11: 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
示例12: _getHtml
/**
* Build and get HTMLv
*
* @param int $level
* @return type
*/
protected function _getHtml($level = 0)
{
foreach ($this->getFormElements() as $formElem) {
// set form values
$name = $formElem->getName();
if (isset($this->_formValues[$name])) {
$formElem->setValue($this->_formValues[$name]);
}
// set input errors
if (isset($this->_errors[$name])) {
$formElem->setErrorMessage($this->_errors[$name]);
}
// set captions
if (isset($this->_captions[$name])) {
$formElem->setCaption($this->_captions[$name]);
}
}
if ($this->_innerContainer instanceof HtmlElement) {
$elements = $this->getElements();
$this->clearNodes();
$this->_innerContainer->addElements($elements);
$this->addElement($this->_innerContainer);
}
return parent::_getHtml($level);
}
开发者ID:2626suke,项目名称:curryfw,代码行数:31,代码来源:html_form.php
示例13: getHeaders
/**
* Get all elements of header rows
*
* @return array
*/
public function getHeaders()
{
$ret = null;
if ($this->_thead instanceof HtmlElement) {
$ret = $this->_thead->getElements();
}
return $ret;
}
开发者ID:2626suke,项目名称:curryfw,代码行数:13,代码来源:html_table.php
示例14: tagButton
/**
* Renders a button. All attributes not listed below will be forwarded to the actual html element
* @param string elm | tag type - defaults to a
* @param string class | CSS class to apply to button
* @param string event | event to trigger when clicked
* @deprecated
* @container
*/
protected function tagButton($attrs, $view)
{
if (!$attrs->elm) {
$attrs->elm = 'a';
}
if (!$attrs->class) {
$attrs->class = '';
}
$class = $this->evt2css($attrs->event);
$attrs->class = trim(trim(self::CSS_BTN . ' ' . $class) . ' ' . $attrs->class);
$elmAttr = ArrayUtil::fromObject($attrs);
unset($elmAttr['elm']);
unset($elmAttr['event']);
$elm = new HtmlElement($attrs->elm, $elmAttr);
$elm->addChild(new HtmlText(trim($this->body())));
return $elm;
}
开发者ID:hofmeister,项目名称:Pimple,代码行数:25,代码来源:WidgetTagLib.php
示例15: testSetCss
/**
* @covers HtmlElement::set
*/
public function testSetCss()
{
$elt = $this->element->set("class", "col-lg-12");
$actual = $elt->getCssClasses();
$excepted = "col-lg-12";
$this->assertInstanceOf("HtmlElement", $elt);
$this->assertContains($excepted, $actual);
}
开发者ID:fruition-sciences,项目名称:phpfw,代码行数:11,代码来源:HtmlElementTest.php
示例16: __construct
/**
* A widget for displaying an image (img)
* @param string $imgurl The url of the image
* @param string $alttext A text that will be shown if the image could not be loaded
* @param boolean $forcehttps Specify if the link has to have https
* @param HtmlAttributes $args Allows custom html tag arguments to be specified (not recommended)
**/
public function __construct($imgurl = EMPTYSTRING, $alttext = EMPTYSTRING, $args = null)
{
HtmlAttributes::Assure($args);
$args->Add('src', $imgurl, true);
$args->Add('alt', $alttext, true);
parent::__construct();
$this->AddChild(new HtmlElement('img', $args));
}
开发者ID:iensenfirippu,项目名称:securipe,代码行数:15,代码来源:Image.php
示例17: recursiveRender
function recursiveRender()
{
if (!is_null($this->sub)) {
$this->add('Text')->set($this->text);
$this->add('HtmlElement')->setElement('small')->set($this->sub);
}
parent::recursiveRender();
}
开发者ID:xavocvijay,项目名称:atkschool,代码行数:8,代码来源:HX.php
示例18: __construct
/**
* A widget containing an unordered list (ul)
* @param HtmlElement[] $items The items for the list
* @param HtmlAttributes $args Allows custom html tag arguments to be specified (not recommended)
**/
public function __construct($items = null, $args = null)
{
parent::__construct('ul', $args);
foreach ($items as $item) {
if (is_a($item, 'HtmlElement')) {
$this->AddChild($item);
}
}
}
开发者ID:iensenfirippu,项目名称:securipe,代码行数:14,代码来源:List.php
示例19: __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
示例20: recursiveRender
public function recursiveRender()
{
if (!is_null($this->sub)) {
/** @type Text $t */
$t = $this->add('Text');
$t->set($this->text);
/** @type HtmlElement $e */
$e = $this->add('HtmlElement');
$e->setElement('small')->set($this->sub);
}
parent::recursiveRender();
}
开发者ID:atk4,项目名称:atk4,代码行数:12,代码来源:HX.php
注:本文中的HtmlElement类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论