选相册图片做封面,改组名,再也不用让用户填URL
I. 修改source/cp_mtag.php找到$setarr['pic'] = getpicurl($_POST['pic'], 150);在上面加一行$setarr['tagname'] = empty($_POST['tagname'])?'':$_POST['tagname'];找到include template("cp_mtag");在上面加一行$albums = getalbums($_SGLOBAL['supe_uid']);II.修改source/do_ajax.php
找到$op = empty($_GET['op'])?'':$_GET['op'];在下面加一行$subop = empty($_GET['subop'])?'':$_GET['subop'];找到while ($value = $_SGLOBAL['db']->fetch_array($query)) {
$value['bigpic'] = mkpicurl($value, 0);
$value['pic'] = mkpicurl($value);
$piclist[] = $value;
$count++;
}修改为while ($value = $_SGLOBAL['db']->fetch_array($query)) {
$value['bigpic'] = (($subop=='groupcover')?getsiteurl():'') . mkpicurl($value, 0);
$value['pic'] = (($subop=='groupcover')?getsiteurl():'') . mkpicurl($value);
$piclist[] = $value;
$count++;
}III.修改template/default/cp_mtag.htm
找到<!--{template header}-->下面加上<script type="text/javascript">
function picView(albumid) {
if(albumid == 'none') {
$('albumpic_body').innerHTML = '';
} else {
ajaxget('do.php?ac=ajax&op=album&subop=groupcover&id='+albumid+'&ajaxdiv=albumpic_body', 'albumpic_body');
}
}
function insertGroupCover(picurl) {
document.getElementById('pic').value = picurl;
}
</script>找到<td>$mtag</td>改为<td><input id="tagname" name="tagname" value="$mtag"></td>找到<tr>
<th width="100"><label for="pic">封面图片</label></th>
<td><input id="pic" type="text" name="pic" value="$mtag" size="80" class="t_input" /><br />请输入 http:// 开头的图片URL地址</td>
</tr>在下面加上<tr>
<th width="100">选择相册图片</th>
<td>
<select name="view_albumid" onchange="picView(this.value)">
<option value="none">选择一个相册</option>
<option value="0">默认相册</option>
<!--{loop $albums $value}-->
<option value="$value">$value</option>
<!--{/loop}-->
</select> (点击图片可以选为群组封面)
<div id="albumpic_body"></div>
</td>
</tr>IV.修改template/default/do_ajax.htm
找到<td><img src="$value" width="60" onclick="insertImage('$value');" style="cursor:hand;"></td>改为<!--{if $subop=='groupcover'}-->
<td><img src="$value" width="60" onclick="insertGroupCover('$value');" style="cursor:hand;"></td>
<!--{else}-->
<td><img src="$value" width="60" onclick="insertImage('$value');" style="cursor:hand;"></td>
<!--{/if}-->
页:
[1]