注意:此方法也适用与其他字段,做好自己的设置即可
1、在<head>中加入
01 |
<script src= "{dede:global.cfg_cmsurl/}/include/dedeajax2.js" type = "text/javascript" ></script> |
02 |
<script language= "javascript" > |
03 |
function CheckLogin_c(){ |
04 |
var taget_obj = document.getElementById( '_userlogin_c' ); |
05 |
var req = document.getElementById( 'hid' ).value; |
06 |
myajax = new DedeAjax(taget_obj, false ,fal se, '' , '' , '' ); |
07 |
myajax.SendGet2( "{dede:global.cfg_cmspath/}/member/ajax_loginsta_c.php?val=" +req); |
|
2、在模板中
1 |
<span id = "_userlogin_c" > |
2 |
购买链接(未登录时候显示):{dede:field.url1/}<br /> |
3 |
市场价格(未登录时候显示):{dede:field.jiage1/}<br /> |
5 |
<input type = "hidden" value= "{dede:field.aid/}" id = "hid" /> |
6 |
<script language= "javascript" type = "text/javascript" >CheckLogin_c();</script> |
|
3、在\member新建一个文件ajax_loginsta_c.php
03 |
* @version $Id: ajax_loginsta.php 1 8:38 2010年7月9日Z tianya $ |
04 |
* @package <a href= "https://www.xmy7.com/" target= "_blank" ><mark>DedeCMS</mark></a>.Member |
05 |
* @copyright Copyright (c) 2007 - 2010, DesDev, Inc. |
06 |
* @license http://help.<a href= "https://www.xmy7.com/" target= "_blank" ><mark>dedecms</mark></a>.com/usersguide/license.html |
07 |
* @link http://www.xmy7 .com |
09 |
require_once( dirname (__FILE__). "/config.php" ); |
11 |
if ($myurl == '' ) exit ( '' ); |
13 |
$uid = $cfg_ml->M_LoginID; |
15 |
!$cfg_ml->fields[ 'face' ] && $face = ($cfg_ml->fields[ 'sex' ] == '女' )? 'dfgirl' : 'dfboy' ; |
16 |
$facepic = empty($face)? $cfg_ml->fields[ 'face' ] : $GLOBALS[ 'cfg_memberurl' ]. '/templets/images/' .$face. '.png' ; |
20 |
$rank=$cfg_ml->M_Rank; |
21 |
$row = $dsql->GetOne( " Select * From `dede_addon19` where `aid`=$val " ); |
25 |
购买链接(已登录):<?php echo $row[ 'url2' ];?><br /> |
26 |
本店价格:<?php echo $row[ 'jiage2' ];?><br /> |
|