精華 如何在帝國PHP系統列表頁和內容頁調用用戶頭像?
<p>帝國php系統?<strong>列表模板的</strong>內容模板(list.var) (*) 調用用戶投稿的頭像方法:</p>
$userr
=
$empire
->fetch1(
"select userpic? from {$dbtbpre}enewsmemberadd where userid='$r[userid]' limit 1"
);
$listtemp
='
<i?
class
=
"avatar"
><img src=
" '.($userr[userpic]?$userr[userpic]:$public_r[newsurl].'skin/jxhx/images/avatar.jpg').' "
></i>
';
內容頁模板調用?投稿用戶的頭像方法:
<?php
$userr
=sys_ShowMemberInfo(0,
''
);
?>
<i?
class
=
"avatar"
><img src=
"<?=$userr[userpic]?$userr[userpic]:'/skin/jxhx/images/avatar.jpg'?>"
></i>
提示:/skin/jxhx/images/avatar.jpg是在用戶沒有設置頭像的時候顯示,地址和圖片改成自己目錄下的用戶默認圖片。