function getsales_history($goods_id) { $where_saled = order_query_sql($type = 'finished'); $sql = 'select u.user_name, g.goods_price, g.goods_number, f.pay_time,g.goods_attr FROM ' . $GLOBALS['ecs']->table('order_goods') . ' as g,' . $GLOBALS['ecs']->table('users') . ' as u, ' . $GLOBALS['ecs']->table('order_info') . ' as f where u.user_id = f.user_id and g.order_id = f.order_id ' . $where_saled . 'and g.goods_id=' . $goods_id . ' order by f.pay_time desc'; $res = $GLOBALS['db']->getAll($sql); $sales_history = array(); foreach ($res as $idx => $row) { $tmp_consignee = utf8Substr($row['user_name'], 0, 1); $tmp_consignee .= "<span style='color:#999'>**</span>"; $tmp_consignee .= utf8Substr($row['user_name'], mb_strlen($row['user_name'], 'utf8') - 1, 1); $row['consignee'] = $tmp_consignee; $sales_history[$idx]['consignee'] = $row['consignee']; $sales_history[$idx]['pay_fee'] = $row['goods_price']; $sales_history[$idx]['goods_number'] = $row['goods_number']; $sales_history[$idx]['pay_time'] = local_date($GLOBALS['_CFG']['time_format'], $row['pay_time']); $sales_history[$idx]['goods_attr'] = $row['goods_attr']; } global $smarty; $smarty->assign('count_sale_history', count($sales_history)); return $sales_history; }
- <?php bloginfo('name'); ?> </title> <?php if ($pid != 0) { if (get_post_field('post_excerpt', $pid)) { $description = get_post_field('post_excerpt', $pid); } else { if (preg_match('/<p>(.*)<\\/p>/iU', trim(strip_tags(get_post_field('post_content', $pid), "<p>")), $result)) { $post_content = $result['1']; } else { $post_content_r = explode("\n", trim(strip_tags(get_post_field('post_content', $pid)))); $post_content = $post_content_r['0']; } $description = utf8Substr($post_content, 0, 220); } $keywords = ""; $tags = wp_get_post_tags($pid); foreach ($tags as $tag) { $keywords = $keywords . $tag->name . ","; } } ?> <meta name="description" content="<?php echo trim($description); ?> " /> <meta name="keywords" content="<?php echo rtrim($keywords, ','); ?>
function getRandomGoods($GOODS_NUM, $GOOD_NAME_LENGTH_LIMIT = 25) { $sql = "SELECT goods_id, goods_name, goods_thumb, original_img, goods_img FROM " . $GLOBALS['ecs']->table('goods') . " ORDER BY RAND() LIMIT {$GOODS_NUM}"; $goods = $GLOBALS['db']->getAll($sql); foreach ($goods as $key => $row) { $goods[$key]['url'] = build_uri('goods', array('gid' => $row['goods_id']), $row['goods_name']); if (strlen($goods[$key]['goods_name']) > $GOOD_NAME_LENGTH_LIMIT) { $goods[$key]['goods_name'] = utf8Substr($goods[$key]['goods_name'], 0, $GOOD_NAME_LENGTH_LIMIT) . "..."; } } return $goods; }
<div style="width: 500px;height: 0px;position: relative;top: -223px;left: 200px;line-height: 1.5em;"> <b>主题:</b><?php echo $row1['title']; ?> <hr style="border-bottom:1px #BC4506 dashed;"> <b>姓名:</b><?php echo $row1['name']; ?> <font style="color: red;padding-left: 50px;">票数:<?php echo $row1['votes']; ?> </font><hr style="border: 1px #BC4506 dashed;"> <b>简介:</b> <?php $ss = $row1['info']; echo " " . utf8Substr($ss, 0, 176); ?> <br> </div> <br> <?php } ?> <div style="margin-bottom: 0px;margin-top: 60px;text-align: center;position: relative;bottom: 0px;clear: both;"> <?php echo $pagenav; ?> </div> </div>
/** * 查询历史记录 * * @access public * @params integer $id * @params integer $page * @return array */ function assign_sale_history($id, $page = 1) { $where_saled = order_query_sql($type = 'finished'); $sql = 'select COUNT(goods_id) FROM ' . $GLOBALS['ecs']->table('order_goods') . ' as g,' . $GLOBALS['ecs']->table('users') . ' as u, ' . $GLOBALS['ecs']->table('order_info') . ' as f where u.user_id = f.user_id and g.order_id = f.order_id ' . $where_saled . 'and g.goods_id=' . $id . ' order by f.pay_time desc'; $count = $GLOBALS['db']->getOne($sql); $size = !empty($GLOBALS['_CFG']['comments_number']) ? $GLOBALS['_CFG']['comments_number'] : 10; $page_count = $count > 0 ? intval(ceil($count / $size)) : 1; $sql = 'select u.user_name, g.goods_price, g.goods_number, f.pay_time,g.goods_attr FROM ' . $GLOBALS['ecs']->table('order_goods') . ' as g,' . $GLOBALS['ecs']->table('users') . ' as u, ' . $GLOBALS['ecs']->table('order_info') . ' as f where u.user_id = f.user_id and g.order_id = f.order_id ' . $where_saled . 'and g.goods_id=' . $id . ' order by f.pay_time desc'; $res = $GLOBALS['db']->selectLimit($sql, $size, ($page - 1) * $size); $sale_historys = array(); while ($row = $GLOBALS['db']->fetchRow($res)) { $tmp_consignee = utf8Substr($row['user_name'], 0, 1); $tmp_consignee .= "<span style='color:#999'>**</span>"; $tmp_consignee .= utf8Substr($row['user_name'], mb_strlen($row['user_name'], 'utf8') - 1, 1); $row['consignee'] = $tmp_consignee; $sale_history = array(); $sale_history['consignee'] = $row['consignee']; $sale_history['pay_fee'] = $row['goods_price']; $sale_history['goods_number'] = $row['goods_number']; $sale_history['pay_time'] = local_date($GLOBALS['_CFG']['time_format'], $row['pay_time']); $sale_history['goods_attr'] = $row['goods_attr']; $sale_historys[] = $sale_history; } /* 分页样式 */ $pager = getBoughtPage(array('currPage' => $page, 'size' => $size, 'count' => $count, 'page_count' => $page_count, 'id' => $id)); $cmt = array('sale_historys' => $sale_historys, 'pager' => $pager); return $cmt; }
} else { $start = $start * 2; $sublen = $sublen * 2; $strlen = strlen($string); $tmpstr = ''; for ($i = 0; $i < $strlen; $i++) { if ($i >= $start && $i < $start + $sublen) { if (ord(substr($string, $i, 1)) > 129) { $tmpstr .= substr($string, $i, 2); } else { $tmpstr .= substr($string, $i, 1); } } if (ord(substr($string, $i, 1)) > 129) { $i++; } } if (strlen($tmpstr) < $strlen) { $tmpstr .= "..."; } return $tmpstr; } } $str = "职位描述:\n1.对所编写的PHP程序进行严格的综合测试,进行系统故障的诊断、定位、分析和调试,以实施产品测试方案. \n2.根据开发进度和任务分配,完成相应模块软件的设计、开发、编程任务\n3.在整个公司监督下定期完成量化的工作要求。\n4.有很高的职业道德操守,有很强的团队意识。\n任职要求:\n1.计算机相关专业专科以上学历; \n2.二年以上PHP/MYSQL/Apache开发经验,具有良好的编程风格; \n3.熟悉smarty模板引擎技术,Jquery框架,了解MVC模形,能完成网站的第二次开发,熟悉ajax技术,熟练使用javascript,CSS,SQL; \n4.有开发过大中型互联网站经验者优先;\n5.熟悉 Web 2.0,了解电子商务行业优先;,"; echo cut_str($str, 160, 0, 'UTF-8'); function utf8Substr($str, $from, $len) { return preg_replace('#^(?:[\\x00-\\x7F]|[\\xC0-\\xFF][\\x80-\\xBF]+){0,' . $from . '}' . '((?:[\\x00-\\x7F]|[\\xC0-\\xFF][\\x80-\\xBF]+){0,' . $len . '}).*#s', '$1', $str); } echo "<br>" . utf8Substr($str, 0, 146);
function seo_post($post_id) { global $post; $description = get_post_meta($post_id, 'description_value', true); $keywords = get_post_meta($post_id, 'keywords_value', true); if (empty($description)) { if (preg_match('/<p>(.*)<\\/p>/iU', trim(strip_tags($post->post_content, "<p>")), $result)) { $post_content = $result['1']; } else { $post_content_r = explode("\n", trim(strip_tags($post->post_content))); $post_content = $post_content_r['0']; } $description = utf8Substr($post_content, 0, 220); update_post_meta($post_id, "description_value", $description); } if (empty($keywords)) { $post_type = $post->post_type; if ($post_type == 'post') { $tax = 'post_tag'; } elseif ($post_type == 'video') { //判断文章类型 $tax = 'video_tags'; } $tags = wp_get_object_terms($post_id, $tax); foreach ($tags as $tag) { $keywords = $keywords . $tag->name . ","; } update_post_meta($post_id, "keywords_value", $keywords); } }
/** * header 的keyword,descript 等SEO meta 标签 * * @version 1.1 * @author Jeff ~ DeveWork.com * */ function mindia_head_meta() { global $post; if (is_home()) { $keywords = beve_option('dw_keywords', ''); $description = beve_option('dw_description', ''); } elseif (is_category()) { $description = strip_tags(trim(category_description())); $keywords = single_cat_title('', false); } elseif (is_single()) { if ($post->post_excerpt) { $description = $post->post_excerpt; } else { $description = utf8Substr(strip_tags($post->post_content), 0, 120); $description = str_replace("\r\n", "", $description); $description = str_replace("\n", "", $description); $description = str_replace("\"", "'", $description); $description .= '...'; } $keywords = ""; $tags = wp_get_post_tags($post->ID); foreach ($tags as $tag) { $keywords = $keywords . $tag->name . ", "; } } ?> <meta name="keywords" content="<?php echo $keywords; ?> " /> <meta name="description" content="<?php echo $description; ?> " /> <?php if (function_exists('get_query_var')) { $cpage = intval(get_query_var('cpage')); if (!empty($cpage)) { echo '<meta name="robots" content="noindex, nofollow" />'; } } }
?> </td> <td class="pubtd"><?php echo $row['sex']; ?> </td> <td class="pubtd" style="width: 138px;"><img src="../uploads/<?php echo $row['picture']; ?> " style="width: 130px;height: 50px;"/></td> <td class="pubtd"><?php echo utf8Substr($row['title'], 0, 30); ?> </td> <td class="pubtd"><?php echo utf8Substr($row['info'], 0, 60); ?> </td> <td class="pubtd"><?php echo $row['votes']; ?> </td> <td class="pubtd"> <a href="./editor.php?edid=<?php echo $row['id']; ?> ">修改</a> / <a href="./delete.php?deid=<?php echo $row['id']; ?> ">删除</a></td>
function widget($args, $instance) { extract($args); $title = apply_filters('title', $instance['title']); $rt_news_id = apply_filters('rt_news_id', $instance['rt_news_id']); $rt_news_number = apply_filters('rt_news_number', $instance['rt_news_number']); $full_size = apply_filters('full_size', $instance['full_size']); $hide_date = apply_filters('hide_date', $instance['hide_date']); if (apply_filters('link_text', $instance['link_text']) != '') { $link_text = apply_filters('link_text', $instance['link_text']); } else { $link_text = "read more"; } $link_text = "..."; if ($id == "Home Page Widget") { $home_page = 1; } $sub_page_class = "small"; $box_image_width = "220"; if (!$rt_news_number) { $rt_news_number = "10"; } ?> <!-- news box --> <div class="box <?php if ($home_page && $full_size && $which_home == 1) { ?> single<?php } elseif ($home_page && $full_size && $which_home == 2) { ?> single fullbox<?php } else { echo $sub_page_class; } ?> "> <!-- box title--> <?php if ($home_page && $full_size) { ?> <h3><?php echo $title; ?> </h3> <?php } else { ?> <h4><a href="<?php echo $home_page . '?cat=3'; ?> "> <?php echo $title; ?> </a></h4> <?php } ?> <div class="textarea"><br /> <!-- box title--> <?php if ($home_page) { ?> <?php if ($title) { ?> <!-- box title--> <h3 class="news shadow"><?php echo $title; ?> </h3> <?php } ?> <?php } ?> <?php $more = 0; $query_string = "showposts=" . $rt_news_number . "&cat=" . get_option('rttheme_blog_ex_cat[]') . "&paged={$paged}"; query_posts($query_string); ?> <?php // 说明:截取utf8字符串 // 整理:http://www.CodeBit.cn function utf8Substr($str, $from, $len) { return preg_replace('#^(?:[\\x00-\\x7F]|[\\xC0-\\xFF][\\x80-\\xBF]+){0,' . $from . '}' . '((?:[\\x00-\\x7F]|[\\xC0-\\xFF][\\x80-\\xBF]+){0,' . $len . '}).*#s', '$1', $str); } ?> <?php if (have_posts()) { while (have_posts()) { the_post(); $title = get_the_title(); $link = get_permalink(); $date = get_the_time('F jS, Y'); $more = 0; ?> <!-- text--> <?php if (!$hide_date) { ?> <span class="news_date"><?php echo $date; ?> </span><br /><?php } ?> <?php $truncTitle = $title; $tmp = $truncTitle; if (strlen($truncTitle) > 25) { $truncTitle = utf8Substr($tmp, 0, 23) . '...'; } ?> <a href="<?php echo $link; ?> " class="news_link" title="<?php echo $title; ?> " target="_self" <?php echo $open_page; ?> ><?php echo $truncTitle; ?> </a> <br /> <!-- <div class="news_line"></div>--> <?php } } ?> <a class="news_more" href="<?php echo $home_page . '?cat=3'; ?> ">更多>>></a> </div> </div> <!-- /news box --> <?php }
<?php $json = array(); $json['message'] = $message; if ($message === null) { foreach ($results as $key => $result) { $json['productList'][$key]['id'] = $result['id']; $json['productList'][$key]['product_id'] = $result['product_id']; $json['productList'][$key]['product_name'] = $result['product_name']; $json['productList'][$key]['product_introduce'] = utf8Substr($result['product_introduce'], 0, 30); $json['productList'][$key]['product_mark'] = $result['product_mark']; $json['productList'][$key]['product_create_time'] = $result['product_create_time']; $json['productList'][$key]['product_thumbnail'] = $result['product_thumbnail']; } } $json = JSON($json); responseJSON($json);