本文整理汇总了PHP中Html::openTag方法的典型用法代码示例。如果您正苦于以下问题:PHP Html::openTag方法的具体用法?PHP Html::openTag怎么用?PHP Html::openTag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Html
的用法示例。
在下文中一共展示了Html::openTag方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
$session = new CHttpSession();
$session->open();
$surSess = Yii::app()->session->get("favorites");
if (!Yii::app()->user->isGuest) {
Yii::import('mod.users.models.UserFavorites');
$modelClass = $this->model;
$currentModule = Yii::app()->controller->module->id;
echo Html::openTag('div', array('id' => 'fav' . $this->model->id, 'class' => 'favorite'));
$modelc = UserFavorites::model()->findAll(array('condition' => '`t`.`user_id`=:userid', 'params' => array(':userid' => Yii::app()->user->getId())));
if (count($modelc) < Yii::app()->settings->get('users', 'favorite_limit')) {
if (isset($modelClass)) {
$model = UserFavorites::model()->find(array('condition' => '`t`.`user_id`=:userid AND `t`.`model_class`=:model_class AND `t`.`object_id`=:id', 'params' => array(':userid' => Yii::app()->user->getId(), ':model_class' => $modelClass->getModelName(), ':id' => $modelClass->id)));
if ($this->view && !isset($model)) {
//
$view = "add";
$params = array('model' => $this->model, 'mod' => $currentModule);
} else {
$view = "remove";
$params = array('favorite_id' => $model->id, 'model' => $this->model, 'object_id' => $this->model->id, 'mod' => $currentModule);
}
}
}
$this->render($view, $params);
echo Html::closeTag('div');
}
}
示例2: run
/**
* @inheritdoc
*/
public function run()
{
if (empty($this->links)) {
return;
}
echo Html::openTag($this->tagName, $this->htmlOptions);
if ($this->homeLink !== false) {
// check whether home link is not a link
$active = stripos($this->homeLink, '<a') === false ? ' class="active"' : '';
echo '<li' . $active . '>' . $this->homeLink . $this->separator . '</li>';
}
end($this->links);
$lastLink = key($this->links);
foreach ($this->links as $label => $url) {
if (is_string($label) || is_array($url)) {
echo '<li>';
echo strtr($this->activeLinkTemplate, ['{url}' => Html::normalizeUrl($url), '{label}' => $this->encodeLabel ? Html::encode($label) : $label]);
} else {
echo '<li class="active">';
echo str_replace('{label}', $this->encodeLabel ? Html::encode($url) : $url, $this->inactiveLinkTemplate);
}
if ($lastLink !== $label) {
echo $this->separator;
}
echo '</li>';
}
echo Html::closeTag($this->tagName);
}
示例3: createHtmlTree
/**
* Create ul html tree from data array
* @param string $data
*/
private function createHtmlTree($data)
{
foreach ($data as $node) {
echo Html::openTag('li', array('id' => $this->id . 'Node_' . $node['id'], 'data-status' => $node['switch'], 'class' => $node['switch'] ? '' : 'hiddenClass'));
echo Html::link(Html::encode($node->name));
if ($node['hasChildren'] === true) {
echo Html::openTag('ul');
$this->createHtmlTree($node['children']);
echo Html::closeTag('ul');
}
echo Html::closeTag('li');
}
}
示例4: createHtmlTree
/**
* Create ul html tree from data array
* @param string $data
*/
private function createHtmlTree($data)
{
foreach ($data as $node) {
echo Html::openTag('li', array());
echo Html::link(Html::encode($node->name));
if ($node['hasChildren'] === true) {
echo Html::openTag('ul');
$this->createHtmlTree($node['children']);
echo Html::closeTag('ul');
}
echo Html::closeTag('li');
}
}
示例5: run
/**
* Render attributes table
*/
public function run()
{
$this->_attributes = $this->model->getEavAttributes();
$data = array();
foreach ($this->getModels() as $model) {
$data[$model->title] = $model->renderValue($this->_attributes[$model->name]);
}
if (!empty($data)) {
$link = '';
if ($this->tagName) {
echo Html::openTag($this->tagName, $this->htmlOptions);
}
foreach ($data as $title => $value) {
$links .= strtr($this->template, array('{title}' => Html::encode($title), '{value}' => Html::encode($value)));
}
echo $links;
if ($this->tagName) {
echo Html::closeTag($this->tagName);
}
}
}
示例6: renderMenuRecursive
protected function renderMenuRecursive($items)
{
foreach ($items as $item) {
if ($this->totalCount) {
$totalCount = '<span class="total_count">(' . $item['total_count'] . ')</span>';
} else {
$totalCount = '';
}
echo Html::openTag('li', isset($item['itemOptions']) ? $item['itemOptions'] : array());
if (isset($item['url'])) {
echo Html::link('<i class="fa ' . $item['icon'] . '"></i> ' . $item['label'] . ' ' . $totalCount, $item['url'], isset($item['linkOptions']) ? $item['linkOptions'] : array());
} else {
echo Html::link('<i class="fa ' . $item['icon'] . '"></i> ' . $item['label'] . ' ' . $totalCount . '<span class="caret"></span>', "javascript:void(0);", isset($item['linkOptions']) ? $item['linkOptions'] : array('class' => 'dropdown-toggle', 'data-toggle' => "dropdown"));
}
if (isset($item['items']) && count($item['items'])) {
echo "\n" . Html::openTag('ul', $this->submenuHtmlOptions) . "\n";
$this->renderMenuRecursive($item['items']);
echo Html::closeTag('ul') . "\n";
}
echo Html::closeTag('li') . "\n";
}
}
示例7: renderItems
protected function renderItems()
{
$result = '';
if ($this->widget) {
$grid = $this->widget->getId();
} else {
$grid = false;
}
if (isset($this->data->switch)) {
$this->items[] = array('htmlOptions' => array('id' => 'FrontControlWidget_switch', 'onClick' => 'control.switchChange(this, "' . $grid . '"); return false;'), 'label' => 'Скрыть', 'url' => $this->data->getSwitchUrl(), 'icon' => 'flaticon-eye');
}
if (isset($this->data->primaryKey)) {
$this->items[] = array('htmlOptions' => array('id' => 'FrontControlWidget_update', 'target' => '_blank'), 'label' => Yii::t('app', 'UPDATE', 1), 'url' => $this->data->getUpdateUrl(), 'icon' => 'flaticon-edit');
$this->items[] = array('htmlOptions' => array('id' => 'FrontControlWidget_remove', 'onClick' => 'control.remove(this, "' . $grid . '"); return false;'), 'label' => Yii::t('app', 'DELETE'), 'url' => $this->data->getDeleteUrl(), 'icon' => 'flaticon-delete');
}
foreach ($this->items as $item) {
$result .= Html::openTag('li');
$result .= Html::link('<i class="' . $item['icon'] . '"></i> ' . $item['label'], $item['url'], $item['htmlOptions']);
$result .= Html::closeTag('li');
}
return $result;
}
示例8: run
/**
* Renders the content of the portlet.
*/
public function run()
{
if (empty($this->links)) {
return;
}
echo Html::openTag($this->tagName, $this->htmlOptions) . "\n";
$content = '';
if ($this->homeLink === null) {
$content .= Html::tag('li', array(), Html::link(Yii::t('zii', 'Home'), Yii::app()->homeUrl), true);
} elseif ($this->homeLink !== false) {
$content .= Html::tag('li', array(), $this->homeLink, true);
}
foreach ($this->links as $label => $url) {
if (is_string($label) || is_array($url)) {
$content .= strtr($this->activeLinkTemplate, array('{url}' => Html::normalizeUrl($url), '{label}' => $this->encodeLabel ? Html::encode($label) : $label));
} else {
$content .= str_replace('{label}', $this->encodeLabel ? Html::encode($url) : $url, $this->inactiveLinkTemplate);
}
}
echo $content;
echo Html::closeTag($this->tagName);
}
示例9: run
public function run()
{
$cs = Yii::app()->getClientScript();
if (Yii::app()->controller->isAjax) {
$cs->registerCoreScript('jquery.ui');
$cs->scriptMap = array('jquery.js' => false);
}
$liContent = '';
$tabContent = '';
$cs->registerScript('tabs', '$(".tabs-form").tabs();', CClientScript::POS_READY);
$n = 0;
foreach ($this->tabs as $title => $content) {
$tabContent .= Html::openTag('div', array('id' => 'tab_' . $n, 'class' => 'tabz'));
$tabContent .= is_array($content) ? $content['content'] : $content;
$tabContent .= Html::closeTag('div');
$title = preg_match('#^(icon-)#ui', $title) ? '<span class="icon-medium ' . $title . ' noBold"></span>' : $title;
$liContent .= '<li><a href="#tab_' . $n . '">' . $title . '</a></li>';
$n++;
}
echo Html::openTag('div', array('class' => 'tabs-form'));
echo '<ul class="tabs">' . $liContent . '</ul>' . $tabContent;
echo Html::closeTag('div');
}
示例10: array
<?php
if ($this->isAjax) {
$this->renderPartial('mod.admin.views.layouts._content-top');
echo Html::openTag('div', array('class' => 'wrapper'));
}
$this->widget('ext.adminList.GridView', array('dataProvider' => $dataProvider, 'name' => $this->pageName, 'enableHeader' => true, 'selectableRows' => false));
if ($this->isAjax) {
echo Html::closeTag('div');
}
示例11: lists
/**
* List elements generator
*
* @access public
*
* @param array $items lists multiple array
* @param array $attributes attributes tag
* @param bool $isNumeric Is a numeric list?
*
* @return string
* @static
*/
public static function lists(array $items = [], array $attributes = [], $isNumeric = false)
{
$parentTag = $isNumeric ? 'ol' : 'ul';
$result = null;
foreach ($items as $item) {
$result .= Html::openTag('li', !empty($item['attr']) ? $item['attr'] : []);
if (!empty($item['parents'])) {
$result .= !empty($item['text']) ? $item['text'] : null;
$result .= self::lists($item['parents'], !empty($item['parentsAttr']) ? $item['parentsAttr'] : [], !empty($item['parentsIsNumeric']) ? true : false);
} else {
$result .= $item['text'];
}
$result .= Html::closeTag('li');
}
return self::openTag($parentTag, $attributes) . $result . self::closeTag($parentTag);
}
示例12: array
}
echo Html::link(Html::image($imgSource, $product->prd->mainImageTitle), array('product/view', 'seo_alias' => $product->prd->seo_alias), array('class' => 'thumbnail'));
?>
</td>
<td>
<?php
echo Html::openTag('h3');
?>
<?php
echo $product->getRenderFullName(false);
?>
<?php
echo Html::closeTag('h3');
?>
<?php
echo Html::openTag('span', array('class' => 'price'));
?>
<?php
echo ShopProduct::formatPrice(Yii::app()->currency->convert($product->price));
?>
<?php
echo Yii::app()->currency->active->symbol;
?>
<?php
echo Html::closeTag('span');
?>
</td>
<?php
if ($config['wholesale']) {
?>
示例13: foreach
echo Html::closeTag('div');
//if (Yii::app()->request->getQuery($filter['queryKey'])) {
// echo Html::link(Yii::t('ShopModule.core', 'сбросить фильтры'), $this->getOwner()->model->viewUrl, array('class' => 'cancel_filter'));
//}
//echo '<div class="clear"></div>';
}
if ($config['filter_enable_attr']) {
// Display attributes
foreach ($attributes as $attrData) {
echo Html::tag('div', array('class' => 'filter-header'), Html::encode($attrData['title']), true);
echo Html::openTag('div', array('class' => 'filter-content'));
echo Html::openTag('ul', array('class' => 'filter_links'));
foreach ($attrData['filters'] as $filter) {
$url = Yii::app()->request->addUrlParam('/shop/category/view', array($filter['queryKey'] => $filter['queryParam']), $attrData['selectMany']);
$queryData = explode(',', Yii::app()->request->getQuery($filter['queryKey']));
echo Html::openTag('li');
// Filter link was selected.
if (in_array($filter['queryParam'], $queryData)) {
//print_r($queryData);
//var_dump(array_search($filter['queryKey'],$queryData));
echo Html::checkBox('filter[' . $filter['queryKey'] . '][]', true, array('value' => $filter['queryParam'], 'data-id' => $filter['queryKey'], 'data-url' => $url, 'id' => $filter['queryKey'] . '_' . $filter['queryParam']));
} elseif (!$filter['count']) {
echo Html::checkBox('filter[' . $filter['queryKey'] . '][]', false, array('value' => $filter['queryParam'], 'data-id' => $filter['queryKey'], 'data-url' => $url, 'id' => $filter['queryKey'] . '_' . $filter['queryParam'], 'disabled' => true));
} else {
echo Html::checkBox('filter[' . $filter['queryKey'] . '][]', false, array('value' => $filter['queryParam'], 'data-id' => $filter['queryKey'], 'data-url' => $url, 'id' => $filter['queryKey'] . '_' . $filter['queryParam']));
// echo $filter['title'] . ' <small>(0)</small>';
}
echo Html::label($filter['title'] . ' (' . $filter['count'] . ')', $filter['queryKey'] . '_' . $filter['queryParam']);
echo Html::closeTag('li');
}
echo Html::closeTag('ul');
示例14: renderMenuRecursive
protected function renderMenuRecursive($items)
{
$this->level++;
foreach ($items as $item) {
if ($this->totalCount) {
$totalCount = '<span class="total_count">(' . $item['total_count'] . ')</span>';
} else {
$totalCount = '';
}
if ($this->level == 2) {
echo Html::openTag('li', array('class' => 'yamm-content'));
} else {
echo Html::openTag('li', isset($item['itemOptions']) ? $item['itemOptions'] : array());
}
if (isset($item['url'])) {
$activeClass = Yii::app()->request->url == '/' . $item['url']['url'] ? 'active' : '';
if (isset($item['linkOptions'])) {
$item['linkOptions']['class'] .= ' ' . $activeClass;
$linkOptions = $item['linkOptions'];
} else {
$linkOptions = array();
}
echo Html::link($item['label'] . ' ' . $totalCount . $this->level, $item['url'], $linkOptions);
} else {
echo Html::link($item['label'] . ' ' . $totalCount, "javascript:void(0);", $linkOptions);
}
if (isset($item['items']) && count($item['items'])) {
echo "\n" . Html::openTag('ul', $this->submenuHtmlOptions) . "\n";
$this->renderMenuRecursive($item['items']);
echo Html::closeTag('ul') . "\n";
}
echo Html::closeTag('li') . "\n";
}
}
示例15: run
/**
* Renders the content of the portlet.
*/
public function run()
{
//if (file_exists(Yii::getPathOfAlias('webroot') . '' . Yii::app()->theme->baseUrl . '/assets/images/bc_defis.png')) {
// $this->separator = '<img src="' . Yii::app()->controller->assetsUrl . '/images/bc_defis.png" alt="" />';
// } else {
// if($this->separator)
// $this->separator = ' '.Yii::app()->settings->get('core', 'bc_defis').' ';
//}
if (empty($this->links)) {
return;
}
echo Html::openTag($this->tagName, $this->htmlOptions) . "\n";
$links = array();
if ($this->homeLink === null) {
$links[] = Html::link(Yii::t('zii', 'Home'), Yii::app()->homeUrl);
} elseif ($this->homeLink !== false) {
$links[] = $this->homeLink;
}
foreach ($this->links as $label => $url) {
if (is_string($label) || is_array($url)) {
$links[] = strtr($this->activeLinkTemplate, array('{url}' => Html::normalizeUrl($url), '{label}' => $this->encodeLabel ? Html::encode($label) : $label));
} else {
$links[] = str_replace('{label}', $this->encodeLabel ? Html::encode($url) : $url, $this->inactiveLinkTemplate);
}
}
echo implode($this->separator, $links);
echo Html::closeTag($this->tagName);
}