本文整理汇总了PHP中html::attributes方法的典型用法代码示例。如果您正苦于以下问题:PHP html::attributes方法的具体用法?PHP html::attributes怎么用?PHP html::attributes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类html
的用法示例。
在下文中一共展示了html::attributes方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: header
public static function header($page = array())
{
$page['js'] = array_merge(array('jquery' => url::common() . '/js/jquery.js', 'plugins' => url::common() . '/js/jquery.plugins.js', 'zotop' => url::common() . '/js/zotop.js'), (array) $page['js']);
$page['css'] = array_merge(array('zotop' => url::theme() . '/css/zotop.css', 'global' => url::theme() . '/css/global.css'), (array) $page['css']);
$page = self::settings($page);
$html[] = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
$html[] = '<html xmlns="http://www.w3.org/1999/xhtml">';
$html[] = '<head>';
$html[] = ' <title>' . $page['title'] . ' Powered by ' . zotop::config("zotop.title") . '</title>';
$html[] = self::meta($page['meta']);
$html[] = self::stylesheet($page['css']);
$html[] = self::script($page['js']);
$html[] = ' ' . html::link(url::theme() . '/image/fav.ico', array('rel' => 'shortcut icon', 'type' => 'image/x-icon'));
$html[] = ' ' . html::link(url::theme() . '/image/fav.ico', array('rel' => 'icon', 'type' => 'image/x-icon'));
$html[] = ' ' . html::link(url::theme() . '/image/fav.ico', array('rel' => 'bookmark', 'type' => 'image/x-icon'));
$html[] = ' <script type="text/javascript">';
$html[] = ' zotop.url.base = "' . url::base() . '";';
$html[] = ' zotop.url.common = "' . url::common() . '";';
$html[] = ' zotop.page.id = "' . page::id() . '";';
$html[] = ' zotop.user.id =0;';
$html[] = ' zotop.user.username = "";';
$html[] = ' </script>';
$html[] = '</head>';
$html[] = '<body' . html::attributes($page['body']) . '>';
$html[] = '<div id="wrapper">';
$html[] = '';
$str = implode("\n", $html);
echo $str;
}
示例2: header
public static function header($form = array())
{
if (isset($form['template'])) {
form::$template = arr::take('template', $form);
}
$attrs['class'] = isset($form['class']) ? $form['class'] : 'form';
$attrs['method'] = isset($form['method']) ? $form['method'] : 'post';
$attrs['action'] = isset($form['action']) ? $form['action'] : url::current();
//加载表头
$html[] = '';
$html[] = '<form' . html::attributes($attrs) . '>';
$html[] = field::hidden(array('name' => '_REFERER', 'value' => request::referer()));
$html[] = field::hidden(array('name' => '_FORMHASH', 'value' => form::hash()));
//加载常用js
$html[] = html::script(url::common() . '/js/jquery.validate.js');
$html[] = html::script(url::common() . '/js/jquery.validate.additional.js');
$html[] = html::script(url::common() . '/js/jquery.form.js');
//表单头部
if (isset($form['title']) || isset($form['description'])) {
$html[] = '<div class="form-header clearfix">';
$html[] = isset($form['icon']) ? ' <div class="form-icon"></div>' : '';
$html[] = isset($form['title']) ? ' <div class="form-title">' . $form['title'] . '</div>' : '';
$html[] = isset($form['description']) ? ' <div class="form-description">' . $form['description'] . '</div>' : '';
$html[] = '</div>';
}
//表单body部分开始
$html[] = '<div class="form-body">';
echo implode("\n", $html);
}
示例3: __toString
public function __toString()
{
$html = '<tr' . html::attributes($this->attributes) . ' >';
foreach ($this->elements as $element) {
$html .= $element->toString();
}
return $html . '</tr>';
}
示例4: init
public function init($id = false, $attributes = false)
{
$this->display_glob = false;
$this->name_col = false;
$this->display_th = false;
$this->display_row = false;
$this->limit_pager = false;
$this->id_table = $id;
$this->attribut = is_array($attributes) ? html::attributes($attributes) : '';
return $this;
}
示例5: getPartialsTemplate
public function getPartialsTemplate()
{
$template = '<thead' . html::attributes($this->attributes) . ' >';
foreach ($this->elements as $element) {
if ($element->isTemplate()) {
$template .= '{{#head}}{{>head}}{{/head}}';
} else {
$template .= $element->toString();
}
}
return $template . '</thead>';
}
示例6: header
public static function header($header = array())
{
$attrs['class'] = isset($header['class']) ? $header['class'] : 'form';
$attrs['method'] = isset($header['method']) ? $header['method'] : 'post';
$attrs['action'] = isset($header['action']) ? $header['action'] : url::current();
$html[] = '';
$html[] = '<form' . html::attributes($attrs) . '>';
$html[] = isset($header['title']) ? '<div class="form-title">' . $header['title'] . '</div>' : '';
$html[] = isset($header['title']) ? '<div class="form-description">' . $header['description'] . '</div>' : '';
$html[] = html::script(url::theme() . '/js/jquery.form.js');
$html[] = html::script(url::theme() . '/js/zotop.form.js');
echo implode("\n", $html);
}
示例7: thumb_img
public function thumb_img($extra_attrs = array(), $max = null, $center_vertically = false)
{
list($height, $width) = $this->scale_dimensions($max);
if ($center_vertically && $max) {
// The constant is divide by 2 to calculate the file and 10 to convert to em
$margin_top = (int) (($max - $height) / 20);
$extra_attrs["style"] = "margin-top: {$margin_top}em";
$extra_attrs["title"] = $this->title;
}
$attrs = array_merge($extra_attrs, array("src" => $this->thumb_url(), "alt" => $this->title, "width" => $width, "height" => $height));
// html::image forces an absolute url which we don't want
return "<img" . html::attributes($attrs) . "/>";
}
示例8: anchor_lang
public static function anchor_lang($lang, $uri, $title = NULL, $attributes = NULL, $protocol = NULL)
{
if ($uri === '') {
$site_url = url::base(FALSE);
} elseif (strpos($uri, '://') === FALSE and strpos($uri, '#') !== 0) {
$site_url = url::site_lang($lang, $uri, $protocol);
} else {
if (html::$windowed_urls === TRUE and empty($attributes['target'])) {
$attributes['target'] = '_blank';
}
$site_url = $uri;
}
return '<a href="' . html::specialchars($site_url, FALSE) . '"' . (is_array($attributes) ? html::attributes($attributes) : '') . '>' . ($title === NULL ? $site_url : $title) . '</a>';
}
示例9: header
public static function header($header = array())
{
$header = self::settings($header);
$html[] = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
$html[] = '<html xmlns="http://www.w3.org/1999/xhtml">';
$html[] = '<head>';
$html[] = ' <title>' . $header['title'] . ' ' . zotop::config("zotop.title") . '</title>';
$html[] = page::meta($header['meta']);
$html[] = page::stylesheet($header['css']);
$html[] = page::script($header['js']);
$html[] = '</head>';
$html[] = '<body' . html::attributes($header['body']) . '>';
$str = implode("\n", $html);
echo $str;
}
示例10: render
public static function render($datas = array(), $attrs = array())
{
$datas = empty($datas) ? table::$datas : $datas;
$attrs = empty($attrs) ? table::$attrs : $attrs;
$titles = arr::take('titles', $attrs);
$footer = table::$footer;
$attrs['class'] = empty($attrs['class']) ? 'table' : 'table ' . $attrs['class'];
//渲染表格
$html[] = '';
$html[] = '<table' . html::attributes($attrs) . '>';
if (is_array($titles)) {
$html[] = ' <thead>';
$html[] = ' <tr class="title">';
foreach ($titles as $name => $title) {
$html[] = ' <th class="' . $name . '"><b>' . $title . '</b></th>';
}
$html[] = ' </tr>';
$html[] = ' </thead>';
}
$html[] = ' <tbody>';
if (is_array($datas) && !empty($datas)) {
$i = 0;
foreach ($datas as $row) {
$html[] = '';
$html[] = ' <tr class="item ' . ($i % 2 == 0 ? 'odd' : 'even') . ' ' . $row['class'] . '">';
foreach ($row['data'] as $key => $value) {
if (is_string($value)) {
$html[] = ' <td class="' . $key . '">' . $value . '</td>';
} else {
$data = arr::take('value', $value);
$html[] = ' <td' . html::attributes($value) . '>' . $data . '</td>';
}
}
$html[] = ' </tr>';
$i++;
}
} else {
$html[] = ' <tr><td colspan="' . count($titles) . '"><div class="zotop-empty">' . zotop::t('未能找到符合要求的数据') . '</div></td></tr>';
}
$html[] = ' </tbody>';
if (!empty($footer)) {
$html[] = ' <tr class="footer"><td colspan="' . count($titles) . '">' . $footer . '</td></tr>';
}
$html[] = '</table>';
return implode("\n", $html);
}
示例11: header
public static function header($header = array())
{
if (isset($header['template'])) {
form::$template = arr::take('template', $header);
}
$attrs['class'] = isset($header['class']) ? $header['class'] : 'form';
$attrs['method'] = isset($header['method']) ? $header['method'] : 'post';
$attrs['action'] = isset($header['action']) ? $header['action'] : url::current();
$html[] = '';
$html[] = '<form' . html::attributes($attrs) . '>';
$html[] = isset($header['title']) ? '<div class="form-title">' . $header['title'] . '</div>' : '';
$html[] = isset($header['description']) ? '<div class="form-description">' . $header['description'] . '</div>' : '';
$html[] = field::hidden(array('name' => '_REFERER', 'value' => request::referer()));
$html[] = html::script(url::common() . '/js/jquery.validate.js');
$html[] = html::script(url::common() . '/js/jquery.validate.additional.js');
$html[] = html::script(url::common() . '/js/jquery.form.js');
$html[] = html::script(url::common() . '/js/zotop.form.js');
echo implode("\n", $html);
}
示例12: row
public static function row($rows, $classname = '')
{
static $i = 0;
if (is_array($rows)) {
$html[] = '';
$html[] = ' <tr class="item ' . ($i % 2 == 0 ? 'odd' : 'even') . ' ' . $classname . '">';
foreach ($rows as $key => $value) {
if (is_string($value)) {
$html[] = ' <td class="' . $key . '">' . $value . '</td>';
} else {
$inner = arr::take('inner', $value);
$html[] = ' <td class="' . $key . '" ' . html::attributes($value) . '>' . $inner . '</td>';
}
}
$html[] = ' </tr>';
$i++;
}
echo implode("\n", $html);
}
示例13: header
public function header()
{
$header = $this->render('header');
if (!$header) {
$javascript = (array) $this->js;
$css = (array) $this->css;
$metas = (array) $this->meta;
$html[] = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
$html[] = '<html xmlns="http://www.w3.org/1999/xhtml">';
$html[] = '<head>';
$html[] = ' <title>' . $this->title . ' ' . zotop::config("zotop.title") . '</title>';
$html[] = ' ' . html::meta('keywords', $this->keywords . ' ' . zotop::config("zotop.keywords"));
$html[] = ' ' . html::meta('description', $this->description . ' ' . zotop::config("zotop.description"));
$html[] = ' ' . html::meta('Content-Type', 'text/html;charset=utf-8');
$html[] = ' ' . html::meta('X-UA-Compatible', 'IE=EmulateIE7');
foreach ($metas as $meta) {
$html[] = ' ' . html::meta($meta);
}
$html[] = ' ' . html::stylesheet('$theme/css/zotop.css', array('id' => 'zotop'));
$html[] = ' ' . html::stylesheet('$theme/css/global.css', array('id' => 'global'));
foreach ($css as $stylesheet) {
$html[] = ' ' . html::stylesheet($stylesheet);
}
$html[] = ' ' . html::script('$common/js/jquery.js', array('id' => 'jquery'));
$html[] = ' ' . html::script('$common/js/jquery.plugins.js', array('id' => 'plugins'));
$html[] = ' ' . html::script('$common/js/zotop.js', array('id' => 'zotop'));
$html[] = ' ' . html::script('$common/js/global.js', array('id' => 'global'));
foreach ($javascript as $js) {
$html[] = ' ' . html::script($js);
}
$html[] = ' ' . html::link('$theme/image/favicon.ico', array('rel' => 'shortcut icon', 'type' => 'image/x-icon'));
$html[] = ' ' . html::link('$theme/image/favicon.ico', array('rel' => 'icon', 'type' => 'image/x-icon'));
$html[] = ' ' . html::link('$theme/image/favicon.ico', array('rel' => 'bookmark', 'type' => 'image/x-icon'));
$html[] = '</head>';
$html[] = '<body' . html::attributes($this->body) . '>';
$html[] = '<div id="wrapper">';
$html[] = '<div id="page">';
$html[] = '';
$header = implode("\n", $html);
}
echo $header;
}
示例14: header
public function header()
{
$html[] = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
$html[] = '<html xmlns="http://www.w3.org/1999/xhtml">';
$html[] = '<head>';
$html[] = ' <title>' . $this->title . ' ' . zotop::config("zotop.title") . '</title>';
$html[] = ' ' . html::meta('keywords', $this->keywords);
$html[] = ' ' . html::meta('description', $this->description);
$html[] = ' ' . html::meta('Content-Type', 'text/html;charset=utf-8');
$html[] = ' ' . html::meta('X-UA-Compatible', 'IE=EmulateIE7');
$html[] = ' ' . html::stylesheet(ZOTOP_APP_URL_CSS . '/zotop.css', array('id' => 'zotop'));
$html[] = ' ' . html::stylesheet(ZOTOP_APP_URL_CSS . '/global.css', array('id' => 'global'));
$html[] = ' ' . html::link(ZOTOP_APP_URL_IMAGE . '/fav.ico', array('rel' => 'shortcut icon', 'type' => 'image/x-icon'));
$html[] = ' ' . html::link(ZOTOP_APP_URL_IMAGE . '/fav.ico', array('rel' => 'icon', 'type' => 'image/x-icon'));
$html[] = ' ' . html::link(ZOTOP_APP_URL_IMAGE . '/fav.ico', array('rel' => 'bookmark', 'type' => 'image/x-icon'));
$html[] = '</head>';
$html[] = '<body' . html::attributes($this->body) . '>';
$str = implode("\n", $html);
echo $str;
}
示例15: header
public static function header($header = array())
{
$header = self::settings($header);
$html[] = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
$html[] = '<html xmlns="http://www.w3.org/1999/xhtml">';
$html[] = '<head>';
$html[] = ' <title>' . $header['title'] . ' ' . zotop::config("zotop.title") . '</title>';
$html[] = self::meta($header['meta']);
$html[] = self::stylesheet($header['css']);
$html[] = self::script($header['js']);
$html[] = ' <script type="text/javascript">';
$html[] = ' zotop.user.id =0;';
$html[] = ' zotop.user.username = "";';
$html[] = ' zotop.url.base = "' . url::base() . '";';
$html[] = ' </script>';
$html[] = '</head>';
$html[] = '<body' . html::attributes($header['body']) . '>';
$html[] = '<div id="wrapper">';
$str = implode("\n", $html);
echo $str;
}