这个问题的话,需要用到一段js代码的,参考官方的写法,先将/member/ajax_loginsta.php这个文件复制一份,命名为ajax_loginsta_c.php
ajax_loginsta_c.php中的代码全部去掉,用下面的替换:
<?php
require_once(dirname(__FILE__)."/config.php");
AjaxHead();
if($myurl == '')
{
exit('');
}
if ($cfg_ml->fields['rank'] >= '10')
{
$row = $dsql->GetOne(" Select * From `dede_youtable` where `aid`=$val ");
echo $row['参考价字段名称英文'];
}
?>
头部这么写(哪个页面就放哪个文件的头部):
<script language="javascript" type="text/javascript" src="{dede:global.cfg_cmsurl/}/include/dedeajax2.js"></script>
<script language="javascript" type="text/javascript">
<!--
function CheckLogin_c(){ var taget_obj = document.getElementById('_userlogin_c'); var req = document.getElementById('hid').value; myajax = new DedeAjax(taget_obj,false,false,'','',''); myajax.SendGet2("{dede:global.cfg_cmspath/}/member/ajax_loginsta_c.php?val="+req); DedeXHTTP = null;}
-->
</script>
模板文件中这么写:
<span id="_userlogin_c">登录查看</span>
<input type="hidden" value="{dede:field.aid/}" id="hid" />
<script language="javascript" type="text/javascript">CheckLogin_c();</script>
测试一下通过,有需要的朋友可以试下!