本文整理汇总了PHP中CHtml::tag方法的典型用法代码示例。如果您正苦于以下问题:PHP CHtml::tag方法的具体用法?PHP CHtml::tag怎么用?PHP CHtml::tag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CHtml
的用法示例。
在下文中一共展示了CHtml::tag方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fieldTips
public static function fieldTips($tips, $htmlOptions = array())
{
if (!isset($htmlOptions['class'])) {
$htmlOptions['class'] = 'field-tips';
}
return CHtml::tag('div', $htmlOptions, $tips);
}
示例2: run
/**
* Renders the content of the widget.
* @throws CException
*/
public function run()
{
// Hide empty breadcrumbs.
if (empty($this->links)) {
return;
}
$links = array();
if (!isset($this->homeLink)) {
$content = CHtml::link(Yii::t('zii', 'Inicio'), Yii::app()->homeUrl);
$links[] = $this->renderItem($content);
} else {
if ($this->homeLink !== false) {
$links[] = $this->renderItem($this->homeLink);
}
}
foreach ($this->links as $label => $url) {
if (is_string($label) || is_array($url)) {
$content = CHtml::link($this->encodeLabel ? CHtml::encode($label) : $label, $url);
$links[] = $this->renderItem($content);
} else {
$links[] = $this->renderItem($this->encodeLabel ? CHtml::encode($url) : $url, true);
}
}
echo CHtml::tag('ul', $this->htmlOptions, implode('', $links));
}
示例3: init
public function init()
{
if (isset($this->htmlOptions['id'])) {
$id = $this->htmlOptions['id'];
} else {
$id = $this->htmlOptions['id'] = $this->getId();
}
if ($this->url !== null) {
$this->url = CHtml::normalizeUrl($this->url);
}
$cs = Yii::app()->getClientScript();
//$cs->registerCoreScript('treeview');
$baseUrl = Yii::app()->getAssetManager()->publish(Yii::getPathOfAlias('ext.yii-jqTree.source'));
$cs->registerScriptFile($baseUrl . '/tree.jquery.js');
$options = $this->getClientOptions();
$options = $options === array() ? '{}' : CJavaScript::encode($options);
$cs->registerScript('Yii.JQTree#0' . $id, "if (jQuery.jqTree == undefined) {jQuery.jqTree = new Array;}");
$cs->registerScript('Yii.JQTree#' . $id, "jQuery.jqTree[\"{$id}\"] = jQuery(\"#{$id}\").tree({$options});");
if ($this->cssFile === null) {
$cs->registerCssFile($baseUrl . '/jqtree.css');
} else {
if ($this->cssFile !== false) {
$cs->registerCssFile($this->cssFile);
}
}
echo CHtml::tag('ul', $this->htmlOptions, false, false) . "\n";
}
示例4: run
/**
* Runs the widget.
*/
public function run()
{
$id = $this->id;
echo CHtml::tag('input', $this->htmlOptions);
$options = !empty($this->options) ? CJavaScript::encode($this->options) : '';
Yii::app()->clientScript->registerScript(__CLASS__ . '#' . $id, "jQuery('#{$id}').typeahead({$options});");
}
示例5: formInput
public function formInput(&$controller, $tagOptions=array())
{
ob_start();
$inputName = $this->formInputName();
$inputID = "i_{$inputName}";
echo CHtml::label($this->label, $inputID);
echo CHtml::tag('br');
if($this->isReadonly)
$tagOptions['disabled'] = true;
if($this->value)
{
$oldOptions = array('readonly'=>true);
if($this->isReadonly)
$tagOptions['disabled'] = true;
echo CHtml::textField("{$inputName}[old]", $this->value, $oldOptions);
unset($oldOptions['readonly']);
?>
<label class="delfile">
<?php echo Yii::t('AutoAdmin.form', '<b class="warning">Delete</b> the file')?> <span class="tip">(<?php echo Yii::t('AutoAdmin.form', 'set checkbox on for confirm')?>)</span>:
<?php echo CHtml::checkBox("{$inputName}[del]", false, $oldOptions);?>
</label>
<?php
}
$tagOptions['id'] = $inputID;
echo CHtml::label(Yii::t('AutoAdmin.form', 'New file').':', $inputID);
?>
<div class="tip inline"><a href=<?php echo $this->options['directoryPath']?>/</div>
<?php
echo CHtml::fileField(AutoAdmin::INPUT_PREFIX."[{$this->name}_new]", null, $tagOptions);
return ob_get_clean();
}
示例6: renderItems
/**
* Renders the data item list.
*/
public function renderItems()
{
echo CHtml::openTag('table', array('class' => 'po-table mind-list')) . "\n";
echo CHtml::openTag('thead') . "\n";
echo CHtml::tag('th', array('width' => 20), ' ') . "\n";
echo CHtml::tag('th', array(), ' ') . "\n";
echo CHtml::tag('th', array('width' => 30), ' ') . "\n";
echo CHtml::tag('th', array('width' => 100), ' ') . "\n";
echo CHtml::tag('th', array('width' => 150), '<span class="mind-list__clear-all">удалить все</span>') . "\n";
echo CHtml::closeTag('thead');
echo CHtml::openTag($this->itemsTagName, array('class' => $this->itemsCssClass)) . "\n";
$data = $this->dataProvider->getData();
if (($n = count($data)) > 0) {
$owner = $this->getOwner();
$viewFile = $owner->getViewFile($this->itemView);
$j = 0;
foreach ($data as $i => $item) {
$data = $this->viewData;
$data['index'] = $i;
$data['data'] = $item;
$data['widget'] = $this;
$owner->renderFile($viewFile, $data);
if ($j++ < $n - 1) {
echo $this->separator;
}
}
}
echo CHtml::closeTag($this->itemsTagName);
echo CHtml::closeTag('table');
}
示例7: actionAdditionType
/**
* 第二个下拉菜单options动态输出
* @author gentle
*/
public function actionAdditionType($fieldType, $additionType = -1, $databaseId = -1, $datasetId = -1)
{
switch ($fieldType) {
//独立字段
case 'normal':
$data = array('text' => '文本', 'multitext' => '多行文本', 'number' => '数值', 'select' => '单选', 'multiselect' => '多选', 'image' => '图片');
break;
//调用元素集字段
//调用元素集字段
case 'reference':
$dsModel = $this->loadModel($databaseId, 'ds', 'database_id', true);
$data = array();
foreach ($dsModel as $key => $value) {
$data[$value->en_name] = $value->name;
}
break;
}
$dropDown = "<option value=''>选择附属类型</option>";
foreach ($data as $value => $name) {
if ($additionType >= 0 && $value == $additionType) {
$dropDown .= CHtml::tag('option', array('value' => $value, 'selected' => 'selected'), CHtml::encode($name), true);
} else {
$dropDown .= CHtml::tag('option', array('value' => $value), CHtml::encode($name), true);
}
}
echo CJSON::encode(array('dropDown' => $dropDown));
}
示例8: showOutput
protected function showOutput()
{
if (!isset($this->htmlOptions['id'])) {
$this->htmlOptions['id'] = $this->id;
}
echo CHtml::tag('div', $this->htmlOptions, '');
}
示例9: PrintDisabledMessage
public static function PrintDisabledMessage()
{
$html = null;
$message = 'This message has been removed.';
$html .= CHtml::tag('div', array('class' => 'alert alert-error'), $message);
return $html;
}
示例10: getHtmlTree
public static function getHtmlTree()
{
$models = self::getRoot()->descendants()->findAll();
$depth = 0;
$res = '';
foreach ($models as $n => $item) {
if ($item->depth == $depth) {
$res .= CHtml::closeTag('li') . "\n";
} else {
if ($item->depth > $depth) {
$res .= CHtml::openTag('ul', array('class' => 'depth_' . $item->depth)) . "\n";
} else {
$res .= CHtml::closeTag('li') . "\n";
for ($i = $depth - $item->depth; $i; $i--) {
$res .= CHtml::closeTag('ul') . "\n";
$res .= CHtml::closeTag('li') . "\n";
}
}
}
$res .= CHtml::openTag('li', array('id' => 'items_' . $item->id, 'class' => 'depth_' . $item->depth));
$res .= CHtml::tag('div', array(), CHtml::encode($item->title) . '<img class="drag" src="/img/admin/hand.png" height="16" width="16" />');
$depth = $item->depth;
}
for ($i = $depth; $i; $i--) {
$res .= CHtml::closeTag('li') . "\n";
$res .= CHtml::closeTag('ul') . "\n";
}
return $res;
}
示例11: run
public function run()
{
echo CHtml::tag($this->tag, array('id' => $this->id));
echo CHtml::closeTag($this->tag);
$options = CJavaScript::encode($this->options);
Yii::app()->getClientScript()->registerScript('jwplayer' . $this->id, "jwplayer('{$this->id}').setup({$options})");
}
示例12: render
public function render()
{
parent::appendOption($this->_htmlOptions, 'class', $this->_cssClass);
echo CHtml::openTag('li', $this->_htmlOptions);
if (!empty($this->_data)) {
echo '<ul>';
foreach ($this->_data as $item) {
$i = $item['icon'];
$l = $item['label'];
$u = $item['url'];
echo '<li>';
if (!empty($i)) {
if (is_array($i)) {
$img = CHtml::tag('img', $i, '');
} else {
$img = CHtml::image($i, CHtml::encode($l));
}
$l = $img . $l;
}
echo CHtml::link($l, $u, @$item['htmlOptions']);
echo '</li>';
}
echo '</ul>';
}
echo CHtml::closeTag('li');
}
示例13: getRank
public function getRank($attribute)
{
if ($this->{$attribute} <= 10) {
return CHtml::tag('span', array('class' => 'top10'), $this->{$attribute});
}
return $this->{$attribute};
}
示例14: run
/**
* Run widget.
*/
public function run()
{
parent::run();
$this->htmlOptions['id'] = $this->map->id;
echo Html::tag($this->tagName, $this->htmlOptions, '');
$this->onAfterRender(new \CEvent($this));
}
示例15: run
/**
* @throws CException
*/
public function run()
{
$this->imageSrc = $this->user->getAvatar($this->size);
$this->imageAlt = $this->user->nick_name;
$this->width = $this->size . 'px';
$this->htmlOptions = ['class' => 'avatar avatar-' . $this->user->id];
if (!$this->height) {
$this->height = $this->width;
}
Yii::app()->clientScript->registerCssFile(Yii::app()->assetManager->publish(Yii::getPathOfAlias('user.assets.css') . '/image-wrapper.css'));
$htmlOptions = ['class' => 'img-wrapper-tocenter', 'style' => 'width: ' . $this->width . '; height: ' . $this->height . '; background-color: ' . $this->backgroundColor . ';'];
if (isset($this->htmlOptions['class'])) {
$class = $this->htmlOptions['class'];
unset($this->htmlOptions['class']);
$htmlOptions['class'] .= ' ' . $class;
}
if (isset($this->htmlOptions['style'])) {
$style = $this->htmlOptions['style'];
unset($this->htmlOptions['style']);
$htmlOptions['style'] .= ' ' . $style;
}
if (is_array($this->htmlOptions) && count($this->htmlOptions) > 0) {
$htmlOptions = array_merge($htmlOptions, $this->htmlOptions);
}
echo CHtml::tag('div', $htmlOptions, CHtml::image($this->imageSrc . ($this->noCache ? '?' . microtime(true) : ''), $this->imageAlt, $this->imageHtmlOptions));
}