蓝色悦动 ,手机模板用户组标签调用出错,乐天有好的建议吗

黑衣人 简单就是美 关注 八级站长 VIP
发表于用户提问版块 资深问题
刚才在调用官方模板,用户组标签的功能,并统一手机模板和电脑模板风格。蓝色悦动 ,手机模板用户组调用出错。。。乐天有好的建议吗


原因是蓝色悦动手机模版比较特殊,列表是php文件的,$readuserdata['usergroupname'] 放在list-2.php里,显示不出数据。。。用$groupdata['usergroupname']可以显示数据,但是不准确。。。


list-2.代码如下


<?php
if (!defined('puyuetian'))
	exit('403');

global $readdata,$readuserdata, $replyuserdata,$groupdata, $replydata, $imgshtml, $lgtime;
$_G['TEMP']['READSPAN'] = '';

if (strpos($readdata['content'], '<a class="pk-text-primary pk-hover-underline" target="_blank" href="index.php?c=app&amp;a=puyuetianeditor:index&amp;s=showfile&amp;id=') !== FALSE) {
	$readdata['title'] .= '&nbsp;<img src="data:image/gif;base64,R0lGODlhIAAgAPf/AIrLWYlGB4nD2XK96mK59MuyJkKu8XcxB+2YCzOk8dfdyery4nJLNFaq33PD7e6cFmTR/ZpzS7KMFmsrBnTQ+v+ZFHXO+XKSKpdtL7jw/6zBy4XWQ0SZypTm/zqKuLdwCXjQOV3D9ah2LJJDC4rb+yeEzFaKp3dDFqRGA4mTcjKd6Pz8+6K+zkGl6sCjEv+rALPIljuz/WvC9Wq87ZdrD4EzBrKwF53QKv+RACGE08iIDpdaB0rC+ppEBLvJz4RbOe3z6ZE6B/y4AYC1JH/CPly+84ji/4Xa/CaN3JS+TJrdMTyh6D17rm+Xizys7X1WMlKs5oVRG4DHP2qx45Tf/HnR91qy4XLH9YY6CXnT+GCx5VK88/SOAlSz8+Xg3U208juq8WPN+3AkBC2R2zin8XLa/4TW+j+u8YrBQ6u9kXvL9pGyzEWh4XfI8SOT7TWj7ES59ZVODodYJma99HK65f+dAHnFKiiK0kC1/WS771Ku6teyhnHGK5V3Y1aRp0Op7JSVV2S16KZ6SCmT4sLp+ZxDCXbN90Ww9GbL90Gx9XDP+FgcAY8/CfS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PTZRQIJ6EPAF4AWCmg2T/QwAiN03ofnIQ38s4YsfXpCRgJkdOGJoYWS8QYDtDByQDd0SXjIIRxIWsIwmLSgggpL6P8xzBJLtNDCMLhisgQDNYixySYH1MAEGH8swcQ/uJTgDBI5lOBsCTnccccyy4xhLRLGYCCCIBFEIIgI9twxhjPF/GNKMMrYksO6OSSTDBLwDiLvIG4AsoscT4iAgRxRSOCHG8qk8M8eujTRjwcIJ9xPKqlw4LDDgJxQwyY7BCDGASI0kUoKDwyMwAuNICDyyAg8UPIDKD+gQxyc1FAxFpzogEAjQvjyzzkf14HDzjxH4nMkoASdiSMsb+MgnR/sU4cQBfyThg0vRMLz1Jpogk4FFaCDjiMBYHHABBNsg8UHXCyNjdNDtKOOJGy3zfY6BcQdtwTbiLHI3ZuIQYMLNtx2gMY/MNyjxC98FG44MsiwozgIjEsQxQmQR07DENYokcQ/39SihDR2dN65N96ws8HopFdzSxy3pJ765JWnIZArqqBxzeyzE0EEALjnjvsJvv4qhhgXSIEGDCcRBcQCyCe/wCzMA+H8AkDk0sf01CsAxCwVZY9QQAA7" alt="附件" title="附件" style="width:14px" />';
}
if ($readdata['high']) {
	$_G['TEMP']['READSPAN'] .= '<span class="aui-label aui-label-danger aui-label-outlined aui-margin-l-5">精</span>';
}

if ($readdata['top']) {
	$_G['TEMP']['READSPAN'] .= '<span class="aui-label aui-label-primary aui-label-outlined aui-margin-l-5">顶</span>';
}

if ($readdata['fs'] > 10) {
	$_G['TEMP']['READSPAN'] .= '<span class="aui-label aui-label-warning aui-label-outlined aui-margin-l-5">热</span>';
}

$readdata['olddata']['content'] = $readdata['content'];
if ($replyuserdata['id'] && $_G['SET']['TEMPLATE_DEFAULT_LISTCONTENTTYPE']) {
	$readdata['content'] = "{$replyuserdata['nickname']}:" . EqualReturn(strip_tags($replydata['content'], ''), '', '[Image]');
}
//图片加载
$imgnum = 0;
$_G['TEMP']['IMGS'] = '';
$imgshtml = array();
$noimglist = 'emotion';
if (preg_match_all('#<img.*?src="(.*?)".*?alt="(.*?)".*?\>#', $readdata['content'], $match)) {
	foreach ($match[1] as $key => $value) {
		if (!InArray($noimglist, $match[2][$key])) {
			if ($imgnum > 2) {
				break;
			}
			$imgshtml[$imgnum] = array('src' => $value);
			$imgnum++;
		}
	}
}

//发表时间人性化
$readlistorder = Cstr($_G['SET']['READLISTORDER'], 'activetime', TRUE, 1, 255);
if ($readlistorder != 'posttime') {
	$readlistorder = 'activetime';
}
$_G['TEMP']['DATE'] = date('Y-m-d', $readdata[$readlistorder]);
if ($_G['TEMP']['DATE'] == date('Y-m-d')) {
	$_G['TEMP']['DATE'] = date('H:i:s', $readdata[$readlistorder]);
}

$_G['TEMP']['READADMINLINK'] = '';
//版主检测
$bkdata = $_G['TABLE']['READSORT'] -> getData($readdata['sortid']);
if (InArray(getUserQX(), 'superman')) {
	if ($readdata['top']) {
		$_G['TEMP']['READADMINLINK'] .= '<a href="javascript:" onclick="pkalert(&quot;确认取消该文章的置顶?&quot;,&quot;提示&quot;,&quot;window.open(\'index.php?c=admincmd&table=read&field=top&value=0&id=' . $readdata['id'] . '&chkcsrfval=' . $_G['CHKCSRFVAL'] . '\',\'pk-di\');pkalert(\'取消成功\')&quot;)">取消置顶</a>&nbsp;';
	} else {
		$_G['TEMP']['READADMINLINK'] .= '<a href="javascript:" onclick="pkalert(&quot;确认设置该文章置顶?&quot;,&quot;提示&quot;,&quot;window.open(\'index.php?c=admincmd&table=read&field=top&value=1&id=' . $readdata['id'] . '&chkcsrfval=' . $_G['CHKCSRFVAL'] . '\',\'pk-di\');pkalert(\'设置成功\')&quot;)">设为置顶</a>&nbsp;';
	}
	if ($readdata['high']) {
		$_G['TEMP']['READADMINLINK'] .= '<a href="javascript:" onclick="pkalert(&quot;确认取消该文章的精华?&quot;,&quot;提示&quot;,&quot;window.open(\'index.php?c=admincmd&table=read&field=high&value=0&id=' . $readdata['id'] . '&chkcsrfval=' . $_G['CHKCSRFVAL'] . '\',\'pk-di\');pkalert(\'取消成功\')&quot;)">取消精华</a>&nbsp;';
	} else {
		$_G['TEMP']['READADMINLINK'] .= '<a href="javascript:" onclick="pkalert(&quot;确认设置该文章精华?&quot;,&quot;提示&quot;,&quot;window.open(\'index.php?c=admincmd&table=read&field=high&value=1&id=' . $readdata['id'] . '&chkcsrfval=' . $_G['CHKCSRFVAL'] . '\',\'pk-di\');pkalert(\'设置成功\')&quot;)">设为精华</a>&nbsp;';
	}
}
if (InArray(getUserQX(), 'admin') || (InArray($bkdata['adminuids'], $_G['USER']['ID']) && $_G['USER']['ID'])) {
	$_G['TEMP']['READADMINLINK'] .= '<a href="index.php?c=edit&type=read&id=' . $readdata['id'] . '">编辑</a>&nbsp;<a href="javascript:" onclick="pkalert(&quot;确认删除该文章?&quot;,&quot;提示&quot;,&quot;window.open(\'index.php?c=delete&table=read&id=' . $readdata['id'] . '&chkcsrfval=' . $_G['CHKCSRFVAL'] . '\',\'pk-di\');$(\'#listdivbox-' . $readdata['id'] . '\').remove()&quot;)">删除</a>';
}

$_G['TEMP']['LISTHTML'] = '';
switch ($imgnum) {
	//有图·图片数为1和2
	case 1 :
	case 2 :
		$_G['TEMP']['LISTHTML'] = '
<li class="aui-list-item" onclick="location.href=\'' . ReWriteURL('read', "id={$readdata['id']}&page=1") . '\'">
	<div class="aui-media-list-item-inner">
		<div class="aui-list-item-inner">
		
				<div style="margin-bottom:5px"class="aui-info-item aui-font-size-12">
					<img style="width:30px"src="userhead/' . $readdata['uid'] . '.png" style="width:1rem" class="aui-img-round" onerror="this.src=\'userhead/0.png\'">
					<span style="color:#33BDA2;font-size:14px"class="aui-margin-l-5">' . $readuserdata['nickname'] . '</span>&nbsp;
					<span style="color:#fff;background-color:#2BBBE6;border-radius:4px;height:16px;padding:0 2px;margin-left:5px;margin-right:5px;">Lv' . Cnum($readuserdata['jifen']/100) . '</span>
					  <span style="color:#fff;background-color:#FFCC00;border-radius:4px;height:16px;padding:0 2px;">' .$groupdata['usergroupname']. '</span>
				</div>
						
			<div style="color:#3E3E3E;font-weight:bold;" class="aui-list-item-title aui-font-size-18">' . $readdata['title'] . '&nbsp;' . $_G['TEMP']['READSPAN'] . '</div>  <!--这个是改帖子列表文章标题,第1部分-->
		
	    	<div class="aui-info aui-padded-b-0">
				<div class="aui-info-item aui-font-size-12">
					<div style="float:right">
					<span class="aui-margin-l-5">' . $_G['TEMP']['DATE'] . '&nbsp;|&nbsp;</span>
					&nbsp;
					<span ><span style="color:#999;font-size:14px"class="fa fa-eye fa-md">&nbsp;</span>'. ($readdata['looknum']) . '&nbsp;<span style="color:#999"class="fa fa-heart ">&nbsp;</span>'. ($readdata['zannum']) . '</span>
					</div>
				</div>
			</div>
			
		</div>
		<div class="aui-list-item-media" style="margin-top:40px;overflow:hidden;max-height:4.5rem;width:130px">
			<img src="' . $imgshtml[0]['src'] . '" onerror="this.src=\'template/puyuetian_jymobile/img/error-img.png\'">
		</div>		
	</div>
	
</li>
';
		break;
	//有图·图片数为3
	case 3 :
		$_G['TEMP']['LISTHTML'] = '
<li class="aui-list-item" onclick="location.href=\'' . ReWriteURL('read', "id={$readdata['id']}&page=1") . '\'">
	<div class="aui-list-item-inner">
	
				<div style="margin-bottom:5px"class="aui-info-item aui-font-size-12">
					<img style="width:30px"src="userhead/' . $readdata['uid'] . '.png" style="width:1rem" class="aui-img-round" onerror="this.src=\'userhead/0.png\'">
					<span style="color:#33BDA2;font-size:14px;"class="aui-margin-l-5">' . $readuserdata['nickname'] . '</span>&nbsp;
					<span style="color:#fff;background-color:#2BBBE6;border-radius:4px;height:16px;padding:0 2px;margin-left:5px;margin-right:5px;">Lv' . Cnum($readuserdata['jifen']/100) . '</span>
					 <span style="color:#fff;background-color:#FFCC00;border-radius:4px;height:16px;padding:0 2px;">' .$groupdata['usergroupname']. '</span>
				</div>
					
		<div style="color:#3E3E3E;font-weight:bold;"class="aui-list-item-title aui-font-size-18">' . $readdata['title'] . '&nbsp;' . $_G['TEMP']['READSPAN'] . '</div>  <!--这个是改帖子列表文章标题,第2部分-->
		<p class="aui-ellipsis-2">' . strip_tags($readdata['content']) . '</p>
		<div class="aui-row aui-row-padded aui-margin-t-5" style="max-height:5.1rem;overflow:hidden"> <!--max-height:5.1rem;这个是改帖子列表图片高度-->
			<div class="aui-col-xs-4">
				<img src="' . $imgshtml[0]['src'] . '" onerror="this.src=\'template/puyuetian_jymobile/img/error-img.png\'">
			</div>
			<div class="aui-col-xs-4">
				<img src="' . $imgshtml[1]['src'] . '" onerror="this.src=\'template/puyuetian_jymobile/img/error-img.png\'">
			</div>
			<div class="aui-col-xs-4">
				<img src="' . $imgshtml[2]['src'] . '" onerror="this.src=\'template/puyuetian_jymobile/img/error-img.png\'">
			</div>
		</div>
	</div>
	<div class="aui-info  aui-padded-t-0 aui-padded-r-15">
		<div class="aui-info-item aui-font-size-12">
			<span class="aui-margin-l-5">' . $_G['TEMP']['DATE'] . '&nbsp;|&nbsp;</span>
		</div>
		<div class="aui-info-item aui-font-size-12">&nbsp;<span style="color:#999;font-size:14px"class="fa fa-eye fa-md">&nbsp;</span>'. ($readdata['looknum']) . '&nbsp;<span style="color:#999"class="fa fa-heart ">&nbsp;</span>'. ($readdata['zannum']) . '</div>
	</div>
</li>
		';
		break;
	//无图
	default :
		$_G['TEMP']['LISTHTML'] = '
<li class="aui-list-item" onclick="location.href=\'' . ReWriteURL('read', "id={$readdata['id']}&page=1") . '\'">
	<div class="aui-media-list-item-inner">
		<div class="aui-list-item-inner">
		    
				<div style="margin-bottom:5px"class="aui-info-item aui-font-size-12">
					<img style="width:30px"src="userhead/' . $readdata['uid'] . '.png" style="width:1rem" class="aui-img-round" onerror="this.src=\'userhead/0.png\'">
					<span style="color:#33BDA2;font-size:14px"class="aui-margin-l-5">' . $readuserdata['nickname'] . '</span>&nbsp;   	
					<span style="color:#fff;background-color:#2BBBE6;border-radius:4px;height:16px;padding:0 2px;margin-left:5px;margin-right:5px;">Lv' . Cnum($readuserdata['jifen']/100) . '</span>	
					 <span style="color:#fff;background-color:#FFCC00;border-radius:4px;height:16px;padding:0 2px;">' .$groupdata['usergroupname']. '</span>
				</div>
			
			<span>粉丝' .$_G['TEMP']['FANS']. '</span>
				
			<div style="color:#3E3E3E;font-weight:bold;" class="aui-list-item-title aui-font-size-18">' . $readdata['title'] . '&nbsp;' . $_G['TEMP']['READSPAN'] . '</div> <!--这个是改帖子列表文章标题,第3部分-->
			<div class="aui-list-item-text">
				<p class="aui-ellipsis-2">' . strip_tags($readdata['content']) . '</p>
			</div>
		</div>
	</div>
	
	<div class="aui-info  aui-padded-t-0 aui-padded-r-15">
		<div class="aui-info-item aui-font-size-12">
			<span class="aui-margin-l-5">' . $_G['TEMP']['DATE'] . '&nbsp;|&nbsp;</span>
		</div>
		<div class="aui-info-item aui-font-size-12">&nbsp;<span style="color:#999;font-size:14px"class="fa fa-eye fa-md">&nbsp;</span>'. ($readdata['looknum']) . '&nbsp;<span style="color:#999"class="fa fa-heart ">&nbsp;</span>'. ($readdata['zannum']) . '</div>
	</div>
	
</li>
';
		break;
}

//发帖用户组
if ($readuserdata['groupid']) {
	$groupdata = $_G['TABLE']['USERGROUP'] -> getData($readuserdata['groupid']);
	$readuserdata['usergroupname'] = $groupdata['usergroupname'];
} else {
	$readuserdata['usergroupname'] = '无组';
}
//粉丝数
$_G['TEMP']['FANS'] = 0;
if ($readuserdata['fans']) {
	$_G['TEMP']['FANS'] = count(explode('__', $readuserdata['fans']));
}

出错的【蓝色悦动手机列表】图片

Image


蓝色悦动手机模版的回复页不出错】,应为放在read-2.hst里就是好的电脑模版也是放在 .hst里都是好的如下

ImageImageImage



评论列表 评论
夜寒 红尘吧 八级站长 VIP 3#
搞定的代码可不可以发一下 这个比之前的好看多了

浙江,杭州

简单就是美:
文件改的太杂了,还没独立出来模版的

简单就是美:
调用了其他模版文件,哪天给整理下,打包成模版

 七岁:
ok

共0条回复,点击查看回复
puyuetian 乐天 九级站长 创始人 2#
用户组名称的数据在用户组表里,你需要先通过:

$data = $_G['TABLE']['USERGROUP'] -> getData($readuserdata['groupid']);
$name = $data['usergroupname'];
获取。

陕西,西安

简单就是美:
需要在用户组数据表里面添加的吧。我就说了,放其他.hst文件数据都可以显示,php就不行了……

简单就是美:
这两句是放在list-2.php里吗?为什么我放到if ($readuserdata['groupid']) {}里,不显示数据呢。。。调用的

简单就是美:
调用$readuserdata['usergroupname']

柳影入池:
饿

共0条回复,点击查看回复
发布评论

评论: 蓝色悦动 ,手机模板用户组标签调用出错,乐天有好的建议吗

已有0次打赏
(1) 分享
分享

请保存二维码或复制链接进行分享

取消