请问如何能在头部调用个人信息中的用户提醒?

2016-07-07 15:04 来源:www.chinab4c.com 作者:ecshop专家

<!-- {if $info.shipped_order} -->

<!-- {/if}-->
这个是用户提醒的代码,请问如何能在member_info.lbi中调用,并且使得每个页面都可以显示?

我把代码加到了头member_info.lbi可是只能在查看个人信息中才能调用成功,而相关的代码是lib_clips.php里的一段:
  1. /**
  2. * 获取用户中心默认页面所需的数据
  3. *
  4. * @accesspublic
  5. * @paramint$user_id用户ID
  6. *
  7. * @returnarray $info默认页面所需资料数组
  8. */
  9. function get_user_default($user_id)
  10. {
  11. $user_bonus = get_user_bonus();

  12. $sql = "SELECT pay_points, user_money, credit_line, last_login, is_validated FROM " .$GLOBALS['ecs']->table('users'). " WHERE user_id = '$user_id'";
  13. $row = $GLOBALS['db']->getRow($sql);
  14. $info = array();
  15. $info['username']= stripslashes($_SESSION['user_name']);
  16. $info['shop_name'] = $GLOBALS['_CFG']['shop_name'];
  17. $info['integral']= $row['pay_points'] . $GLOBALS['_CFG']['integral_name'];
  18. /* 增加是否开启会员邮件验证开关 */
  19. $info['is_validate'] = ($GLOBALS['_CFG']['member_email_validate'] && !$row['is_validated'])?0:1;
  20. $info['credit_line'] = $row['credit_line'];
  21. $info['formated_credit_line'] = price_format($info['credit_line'], false);

  22. //如果$_SESSION中时间无效说明用户是第一次登录。取当前登录时间。
  23. $last_time = !isset($_SESSION['last_time']) ? $row['last_time'] : $_SESSION['last_time'];

  24. if ($last_time == 0)
  25. {
  26. $_SESSION['last_time'] = $last_time = gmtime();
  27. }

  28. $info['last_time'] = local_date($GLOBALS['_CFG']['time_format'], $last_time);
  29. $info['surplus']= price_format($row['user_money'], false);
  30. $info['bonus']= sprintf($GLOBALS['_LANG']['user_bonus_info'], $user_bonus['bonus_count'], price_format($user_bonus['bonus_value'], false));

  31. $sql = "SELECT COUNT(*) FROM " .$GLOBALS['ecs']->table('order_info').
  32. " WHERE user_id = '" .$user_id. "' AND add_time > '" .local_strtotime('-1 months'). "'";
  33. $info['order_count'] = $GLOBALS['db']->getOne($sql);

  34. include_once(ROOT_PATH . 'includes/lib_order.php');
  35. $sql = "SELECT order_id, order_sn ".
  36. " FROM " .$GLOBALS['ecs']->table('order_info').
  37. " WHERE user_id = '" .$user_id. "' AND shipping_time > '" .$last_time. "'". order_query_sql('shipped');
  38. $info['shipped_order'] = $GLOBALS['db']->getAll($sql);

  39. return $info;
  40. }
复制代码


所以无法在其它界面调用,请问大大们如何实现在其它任何界面都可以使用啊?对PHP代码不熟悉,麻烦您了!

回答:
我把此代码复制到了lib_common.php中,也不好使,都怿自己太笨啦,不懂得语言.