php新手,问下一个小问题 我使用discuz2.5建的一个社区,日志在后台开启了分类,如:心情日记。搞笑日志。等我现在想点击日志的“心情日记”分类以后,再点击发布日志,进入发布的页面,发布日志里面有站点分类,就是我的日志分类,我想让进入页面后默认的就是我点击的“心情日记”分类,不知道该怎么实现??????、唉,新手代码还不怎么会写,求老师指导、、、 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 自己做的话可以传递参数,不传递默认的时候就header 到你想去的地方. 仔细看了一下发现答错了你要的是 心情日记 分类?你这个分类是要默认显示?还是什么意思?这个分类用的是什么?select? 在相应的模板里找,这个分类应该是做成了单选按钮的形式,设置 checked="checked"如果是下拉列表的形式,就设置相应的option 为selected. 那就是我说的传递值么..比如 心情日志 的代码是 1 那么就在点击进去的时候传递type=1http://xxx.com/edit.php?type=1然后根据这个type 获取是什么类型提交的时候再带上这个参数值<input type="hidden" name="type" value="1">不就可以了...总之先将分类进行类型匹配...然后传递相应的值. <table cellspacing="0" cellpadding="0" class="tfm"> <tr><table cellspacing="0" cellpadding="0" width="100%" class="tfm"> <!--{if $_G['setting']['blogcategorystat'] && $categoryselect}--> <tr> <th>{lang site_categories}</th> <td> $categoryselect ({lang select_site_blog_categories}) </td> </tr></table>上面这是分类的html代码不知道怎么看,不是太懂这段代码if($_G['setting']['blogcategorystat']) { loadcache('blogcategory'); $category = $_G['cache']['blogcategory']; $categoryselect = ''; if($category) { include_once libfile('function/portalcp'); $categoryselect = category_showselect('blog', 'catid', !$_G['setting']['blogcategoryrequired'] ? true : false, $blog['catid']); } } $menuactives = array('space'=>' class="active"');}这应该是分类信息后台控制的代码,不知道是不是,if(submitcheck('blogsubmit', 0, $seccodecheck, $secqaacheck) && helper_access::check_module('blog')) { if(empty($blog['blogid'])) { $blog = array(); } else { if(!checkperm('allowblog')) { showmessage('no_privilege_blog'); } } if($_G['setting']['blogcategorystat'] && $_G['setting']['blogcategoryrequired'] && !$_POST['catid']) { showmessage('blog_choose_system_category'); } require_once libfile('function/blog'); if($newblog = blog_post($_POST, $blog)) { if(empty($blog) && $newblog['topicid']) { $url = 'home.php?mod=space&uid='.$_G['uid'].'&do=topic&topicid='.$newblog['topicid'].'&view=blog&quickforward=1'; } else { $url = 'home.php?mod=space&uid='.$newblog['uid'].'&do=blog&quickforward=1&id='.$newblog['blogid']; } if($_GET['modblogkey']) { $url .= "&modblogkey=$_GET[modblogkey]"; } dsetcookie('clearUserdata', 'home'); showmessage('do_success', $url); } else { showmessage('that_should_at_least_write_things', NULL, array(), array('return'=>1)); }}这是发布日志按钮的代码<!--{if $space[self]}--><span class="xi2 y"> <a href="home.php?mod=spacecp&ac=blog" class="addnew">{lang post_new_blog//发表新日志}</a></span><!--{/if}-->上是发表日志的连接按钮不知道您能看出大概吗??????????????????? centos能切换会桌面吗?我承认我手欠了。 为什么 我Session的值取不到... php utf-8、gb2312乱码问题 22岁生日,散分220 php+mysql查询 js嵌套文件里面再嵌套一个php文件 为什么无效 简体系统与繁体系统传送中文参数的困扰 刚在RedHat8.0下装了个PhpEd3.1 请问怎么样修改字段的长度?/比如原来是 varchar(50)改成100的,是mysql数据库? 我想转向PHP,但不知mysql数据库有没有形成类似.mdb样的文件好下载备份? {dede:php}标签两段里变量不同? 诡异事件,数组问题
提交的时候再带上这个参数值
<input type="hidden" name="type" value="1">
不就可以了...
总之先将分类进行类型匹配...然后传递相应的值.
<tr><table cellspacing="0" cellpadding="0" width="100%" class="tfm"> <!--{if $_G['setting']['blogcategorystat'] && $categoryselect}-->
<tr>
<th>{lang site_categories}</th>
<td>
$categoryselect ({lang select_site_blog_categories})
</td>
</tr></table>
上面这是分类的html代码不知道怎么看,不是太懂这段代码
if($_G['setting']['blogcategorystat']) {
loadcache('blogcategory');
$category = $_G['cache']['blogcategory']; $categoryselect = ''; if($category) {
include_once libfile('function/portalcp');
$categoryselect = category_showselect('blog', 'catid', !$_G['setting']['blogcategoryrequired'] ? true : false, $blog['catid']);
}
} $menuactives = array('space'=>' class="active"');
}
这应该是分类信息后台控制的代码,不知道是不是,if(submitcheck('blogsubmit', 0, $seccodecheck, $secqaacheck) && helper_access::check_module('blog')) { if(empty($blog['blogid'])) {
$blog = array();
} else {
if(!checkperm('allowblog')) {
showmessage('no_privilege_blog');
}
} if($_G['setting']['blogcategorystat'] && $_G['setting']['blogcategoryrequired'] && !$_POST['catid']) {
showmessage('blog_choose_system_category');
}
require_once libfile('function/blog');
if($newblog = blog_post($_POST, $blog)) {
if(empty($blog) && $newblog['topicid']) {
$url = 'home.php?mod=space&uid='.$_G['uid'].'&do=topic&topicid='.$newblog['topicid'].'&view=blog&quickforward=1';
} else {
$url = 'home.php?mod=space&uid='.$newblog['uid'].'&do=blog&quickforward=1&id='.$newblog['blogid'];
}
if($_GET['modblogkey']) {
$url .= "&modblogkey=$_GET[modblogkey]";
}
dsetcookie('clearUserdata', 'home');
showmessage('do_success', $url);
} else {
showmessage('that_should_at_least_write_things', NULL, array(), array('return'=>1));
}
}这是发布日志按钮的代码
<!--{if $space[self]}--><span class="xi2 y"> <a href="home.php?mod=spacecp&ac=blog" class="addnew">{lang post_new_blog//发表新日志}</a></span><!--{/if}-->
上是发表日志的连接按钮
不知道您能看出大概吗???????????????????