网站分了三级栏目,我想在第三极栏目调用第一级栏目的分类id,换句话就是孙栏目怎么调用到爷栏目的id。
解决方法:WM老大的回复
可以用自定义标签或模板中直接模板中用php代码获得:
参数设置开启模板支持程序代码,下面为获得爷栏目id代码
<?php
$bclassid=$class_r[$GLOBALS[navclassid]][bclassid];//上级栏目id
$bbclassid=$class_r[$bclassid][bclassid];//上上级栏目id
?>
在phpmyadmin中输入如下语句
DROP TABLE IF EXISTS newstemp1;
CREATE TEMPORARY TABLE
newstemp1(id VARCHAR(10),title VARCHAR(250)) TYPE=HEAP;
insert into newstemp1(id,title) select max(b.id),b.title from phome_ecms_news a , phome_ecms_news b where a.title=b.title and a.id!=b.id group by b.title;
delete phome_ecms_news a from phome_ecms_news a,newstemp1 b where a.title=b.title and a.id!=b.id;
fck用php整合
php整合方法:
1,下载官方的文件,
include("fckeditor/fckeditor.php");//fck类加载
$oFCKeditor = new FCKeditor('newstext') ; // 创建FCKeditor实例
$oFCKeditor->BasePath = 'fckeditor/'; // 设置FCKeditor目录地址
$FCKeditor->Width='100%'; //设置显示宽度
$FCKeditor->Height='300px'; //设置显示高度的高度
$oFCKeditor->Create() ; // 创建编辑器
2,需要修改部分文件
fckeditor_php5.php文件中的
// Render the linked hidden field下面的input改为textarea
fckeditor_php4.php也做相应修改
3,利用sablog的启发,调用fck的api
在addnews.php中加入下面的东西
<script>
//sablog
function addhtml(newstext){
var oEditor = FCKeditorAPI.GetInstance('newstext');
if ( oEditor.EditMode == FCK_EDITMODE_WYSIWYG ) {
oEditor.InsertHtml(newstext) ;
} else {
alert('请先转换到所见即所得模式') ;
}
}
var smdirurl = 'http://localhost';
//插入表情
function insertsmiley(icon){
addhtml('<img src="'+smdirurl+icon+'" border="0" alt="" />');
}
</script>
4,在html/1.php中的合适位置增加
<tr><td>图片插入工具:</td><td>
<img src="/images/smiles/angry.gif" alt="" onclick="javascript:insertsmiley(document.add.titlepic.value)" /></td></tr>
5,做合适的修改,这是使用缩略图的对话框实现的,就是有些笨,用着还可以。
4月1日,今天通过努力自己可以添加fck的按钮,当然是按钮直接连接到ecms的上传组件,经过了两三次js和php间的传值,特别麻烦,还是下面的外挂式整合来的轻松,这就是天使不在他的精简编辑器中不加入上传自己的原因,其中的漏洞也没有人知道。
参考了
http://blog.csdn.net/flying_huang/archive/2007/03/23/1539206.aspx
http://www.javaeye.com/topic/150487
在/html/1.php合适位置加入
<a onclick="window.open('editor/file.php?userid=<?=$logininid?>&username=<?=$loginin?>&rnd=<?=$loginrnd?>&type=1&classid=<?=$classid?>&filepass=<?=$filepass?>','','width=700,height=550,scrollbars=yes');" title="上传图片"><img src="editor/images/img.gif" /></a><a onclick="window.open('editor/file.php?userid=<?=$logininid?>&username=<?=$loginin?>&rnd=<?=$loginrnd?>&type=2&classid=<?=$classid?>&filepass=<?=$filepass?>','','width=700,height=550,scrollbars=yes');" title="上传FLASH"><img src="editor/images/flash.gif" /></a><a onclick="window.open('editor/file.php?userid=<?=$logininid?>&username=<?=$loginin?>&rnd=<?=$loginrnd?>&type=0&classid=<?=$classid?>&filepass=<?=$filepass?>','','width=700,height=550,scrollbars=yes');" title="上传附件"><img src="editor/images/file.gif" /></a><a onclick="window.open('editor/file.php?userid=<?=$logininid?>&username=<?=$loginin?>&rnd=<?=$loginrnd?>&type=3&classid=<?=$classid?>&filepass=<?=$filepass?>','','width=700,height=550,scrollbars=yes');" title="上传多媒体文件"><img src="editor/images/rm.gif" /></a><a onclick="window.open('editor/TranMore.php?userid=<?=$logininid?>&username=<?=$loginin?>&rnd=<?=$loginrnd?>&type=1&classid=<?=$classid?>&filepass=<?=$filepass?>','','width=700,height=550,scrollbars=yes');" title="上传多图片"><img src="editor/images/tranmoreimg.gif" /></a>
充分利用帝国自身的文件
在file.php加入
function DoFile(html1)
{ var oEditor = opener.FCKeditorAPI.GetInstance('newstext') ;
oEditor.InsertHtml(html1);
}
function InsertFile(filename,fname,fileid,filesize,filetype,fileno,dotype){
var vstr="";
if(dotype!=undefined)
{
vstr=showModalDialog("popups/insertfile.php?ecms="+dotype+"&fname="+fname+"&fileid="+fileid+"&filesize="+filesize+"&filetype="+filetype+"&filename="+filename, "", "dialogWidth:45.5em; dialogHeight:27.5em; status:0");
if(vstr==undefined)
{
return false;
}
}
DoFile(vstr);
window.close();
}
其他的参看其他帖子