Beispiel #1
0
/**
 * Create an image tag.
 *
 * i('foo.png', array('alt' => 'Hello'))
 * i('bar.png', '#my-image')
 * i('baz.gif', '#my-image.my-class', array('width' => 500))
 */
function i($src, $options_or_selector = array(), $options = array())
{
    $options += parse_simple_selector($options_or_selector);
    $options['src'] = url_for_image($src);
    $options += array('alt' => '');
    return empty_tag('img', $options);
}
Beispiel #2
0
function radio_button_tag($name, $value, $current_value = null, $options = array())
{
    $options['type'] = 'radio';
    $options['name'] = $name;
    $options['value'] = $value;
    if ($value == $current_value || $current_value === true) {
        $options['checked'] = 'checked';
    }
    return empty_tag('input', $options);
}
Beispiel #3
0
function get_side_message()
{
    $where = "rel_table = 'faq'";
    if (app_conf("USER_MESSAGE_AUTO_EFFECT") == 0) {
        $where .= " and user_id = " . intval($GLOBALS['user_info']['id']);
    } else {
        $message_type = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "message_type where type_name = 'faq'");
        if ($message_type['is_effect'] == 0) {
            $where .= " and user_id = " . intval($GLOBALS['user_info']['id']);
        }
    }
    $side_message = get_message_list(app_conf("SIDE_MESSAGE_COUNT"), $where);
    foreach ($side_message['list'] as $k => $v) {
        $side_message['list'][$k]['url'] = url("tuan", "message#faq") . "#consult-entry-" . $v['id'];
        $side_message['list'][$k]['content'] = empty_tag($v['content']);
    }
    return $side_message;
}
Beispiel #4
0
 /**
  * Создать html тег для подключения файла с CSS стилями
  *
  * @param string $css путь к файлу со стилями
  * @param array $options дополнительный массив аттрибутов тега link
  * @return string
  */
 function stylesheet_link_tag($css, $options = array())
 {
     $options['href'] = $css;
     $options['rel'] = 'stylesheet';
     $options['type'] = 'text/css';
     return empty_tag('link', $options);
 }
Beispiel #5
0
function input_tag($attributes = array())
{
    return empty_tag('input', $attributes);
}