<?php/**
* ECMALL: 文章 * $Id: article.php 6009 2008-10-31 01:55:52Z Garbin $
*/if (!defined('IN_ECM'))
{
trigger_error('Hacking attempt', E_USER_ERROR);
}include_once(ROOT_PATH . '/includes/lib.editor.php');class ArticleController extends ControllerFrontend
{
var $_allowed_actions = array('site_news', 'builtin'); /**
* 构造函数
*/
function __construct($act)
{
$this->ArticleController($act);
} function ArticleController($act)
{
if (empty($act))
{
$act = 'view';
}
parent::__construct($act);
}
/**
** 得到新闻类别名
**/
function get_news_type($cateid)
{
$_GET['sort'] = 'is_top';
$_GET['order'] = 'asc';
include_once(ROOT_PATH . '/includes/manager/mng.article.php');
$article_mng = new ArticleManager(0);
$condition = array('cate_id' => $cateid, 'if_show' => 1);
return $article_mng->get_list(1, $condition, 1); } /**得到最新新闻(不分类)**/
function get_all_news($num)
{
include_once(ROOT_PATH . '/includes/manager/mng.article.php');
$res = new ArticleManager(0);
return $res->get_article_all($num);
}
/*得到新闻*/
function get_site_news($cateid,$num)
{
$_GET['sort'] = 'is_top';
$_GET['order'] = 'asc';
include_once(ROOT_PATH . '/includes/manager/mng.article.php');
$article_mng = new ArticleManager(0);
$condition = array('cate_id' => $cateid, 'if_show' => 1);
return $article_mng->get_list(1, $condition, $num);
}
/**
* 站内快讯
*
* @author wj
* @return void
*/
function site_news()
{
/* 参数 */
$id = empty($_GET['id']) ? 0 : intval($_GET['id']);
$type=$_GET['tid'];
$tid= is_numeric($type) ? $type : ARC_NEWS; // 根据新闻分类显示新闻(默认显示快讯)
if ($id == 0)
{
/* 取得快讯列表 */
include_once(ROOT_PATH . '/includes/manager/mng.article.php');
$mng_article = new ArticleManager(0);
$condition = array(
'cate_id' => $tid, //ARC_NEWS,
'if_show' => 1
);
$_GET['sort'] = 'add_time';
$_GET['order'] = 'desc';
$article_list = $mng_article->get_list($this->get_page(), $condition, 15);
$this->assign('article_list', $article_list);
/* 当前位置和title */
$this->assign('location_data', array(
array('name' => $this->lang('site_news'))
));
$this->set_title(array($article['site_news']));
$this->assign('title', $this->lang('site_news'));
}
else
{
/* 取得快讯详情 */
include_once(ROOT_PATH . '/includes/models/mod.article.php');
$mod_article = new Article($id, 0);
$article = $mod_article->get_info();
if (empty($article))
{
$this->show_warning('article_not_exists');
return;
}
if ($article['editor_type'] == 0)
{
$article['content'] = Editor::parse($article['content']);
}
$this->assign('article', $article);
/* 当前位置和title */
$this->assign('location_data', array(
array('name' => $this->lang('site_news'), 'url' => 'index.php?app=article&act=site_news'),
array('name' => $article['title'])
));
$this->set_title(array($this->lang('site_news'), $article['title']));
}
/******* 这是为了得到文章分类增加的begin*******/
/*加入代码后, 文章详细页中文章内容中的UBB代码不解析了(比如图片)*/
$this->assign('calling_news_type', $this->get_news_type($tid)); //文章分类
$this->assign('article_news_all',$this->get_all_news(9)); /// 得到最新新闻9条数据
$this->assign('get_site_news',$this->get_site_news(44,9)); // 得到专题新闻
/******* 这是为了得到文章分类增加的 end *******/
$this->display('site_news', 'mall');
} /**
* 查看内置的文章内容
*
* @return void
*/
function builtin()
{
$code = trim($_GET['code']); if (empty($code))
{
$this->show_warning('article_not_exists'); return;
} include_once(ROOT_PATH . '/includes/models/mod.article.php');
$mod_article = new Article(0, 0, $code);
$article = $mod_article->get_info();
if (empty($article))
{
$this->show_warning('article_not_exists'); return;
} include_once(ROOT_PATH . '/includes/lib.editor.php');
if ($article['editor_type'] == 0)
{
$article['content'] = Editor::parse($article['content']);
} $this->assign('article', $article); /* 取得图片推荐商品 */
$_GET['sort'] = 'sort_weighing';
include_once(ROOT_PATH . '/includes/manager/mng.goods.php');
$mng_goods = new GoodsManager(0);
$condition = array(
'is_on_sale' => 1,
'is_mi_best' => 1
);
$this->assign('image_goods', $mng_goods->get_list(1, $condition, 6)); /* 取得文字推荐商品 */
$condition = array(
'is_on_sale' => 1,
'is_mw_best' => 1
);
$this->assign('words_goods', $mng_goods->get_list(1, $condition, 6)); /* 取得热销商品 */
$condition = array(
'is_on_sale' => 1,
'is_m_hot' => 1
);
$this->assign('sales_goods', $mng_goods->get_list(1, $condition, 10)); /* 当前位置 */
$this->assign('location_data', array(
array('name' => $article['title'])
)); $this->set_title(array($article['title'])); $this->display('site_news', 'mall');
}
}
?>
* ECMALL: 文章 * $Id: article.php 6009 2008-10-31 01:55:52Z Garbin $
*/if (!defined('IN_ECM'))
{
trigger_error('Hacking attempt', E_USER_ERROR);
}include_once(ROOT_PATH . '/includes/lib.editor.php');class ArticleController extends ControllerFrontend
{
var $_allowed_actions = array('site_news', 'builtin'); /**
* 构造函数
*/
function __construct($act)
{
$this->ArticleController($act);
} function ArticleController($act)
{
if (empty($act))
{
$act = 'view';
}
parent::__construct($act);
}
/**
** 得到新闻类别名
**/
function get_news_type($cateid)
{
$_GET['sort'] = 'is_top';
$_GET['order'] = 'asc';
include_once(ROOT_PATH . '/includes/manager/mng.article.php');
$article_mng = new ArticleManager(0);
$condition = array('cate_id' => $cateid, 'if_show' => 1);
return $article_mng->get_list(1, $condition, 1); } /**得到最新新闻(不分类)**/
function get_all_news($num)
{
include_once(ROOT_PATH . '/includes/manager/mng.article.php');
$res = new ArticleManager(0);
return $res->get_article_all($num);
}
/*得到新闻*/
function get_site_news($cateid,$num)
{
$_GET['sort'] = 'is_top';
$_GET['order'] = 'asc';
include_once(ROOT_PATH . '/includes/manager/mng.article.php');
$article_mng = new ArticleManager(0);
$condition = array('cate_id' => $cateid, 'if_show' => 1);
return $article_mng->get_list(1, $condition, $num);
}
/**
* 站内快讯
*
* @author wj
* @return void
*/
function site_news()
{
/* 参数 */
$id = empty($_GET['id']) ? 0 : intval($_GET['id']);
$type=$_GET['tid'];
$tid= is_numeric($type) ? $type : ARC_NEWS; // 根据新闻分类显示新闻(默认显示快讯)
if ($id == 0)
{
/* 取得快讯列表 */
include_once(ROOT_PATH . '/includes/manager/mng.article.php');
$mng_article = new ArticleManager(0);
$condition = array(
'cate_id' => $tid, //ARC_NEWS,
'if_show' => 1
);
$_GET['sort'] = 'add_time';
$_GET['order'] = 'desc';
$article_list = $mng_article->get_list($this->get_page(), $condition, 15);
$this->assign('article_list', $article_list);
/* 当前位置和title */
$this->assign('location_data', array(
array('name' => $this->lang('site_news'))
));
$this->set_title(array($article['site_news']));
$this->assign('title', $this->lang('site_news'));
}
else
{
/* 取得快讯详情 */
include_once(ROOT_PATH . '/includes/models/mod.article.php');
$mod_article = new Article($id, 0);
$article = $mod_article->get_info();
if (empty($article))
{
$this->show_warning('article_not_exists');
return;
}
if ($article['editor_type'] == 0)
{
$article['content'] = Editor::parse($article['content']);
}
$this->assign('article', $article);
/* 当前位置和title */
$this->assign('location_data', array(
array('name' => $this->lang('site_news'), 'url' => 'index.php?app=article&act=site_news'),
array('name' => $article['title'])
));
$this->set_title(array($this->lang('site_news'), $article['title']));
}
/******* 这是为了得到文章分类增加的begin*******/
/*加入代码后, 文章详细页中文章内容中的UBB代码不解析了(比如图片)*/
$this->assign('calling_news_type', $this->get_news_type($tid)); //文章分类
$this->assign('article_news_all',$this->get_all_news(9)); /// 得到最新新闻9条数据
$this->assign('get_site_news',$this->get_site_news(44,9)); // 得到专题新闻
/******* 这是为了得到文章分类增加的 end *******/
$this->display('site_news', 'mall');
} /**
* 查看内置的文章内容
*
* @return void
*/
function builtin()
{
$code = trim($_GET['code']); if (empty($code))
{
$this->show_warning('article_not_exists'); return;
} include_once(ROOT_PATH . '/includes/models/mod.article.php');
$mod_article = new Article(0, 0, $code);
$article = $mod_article->get_info();
if (empty($article))
{
$this->show_warning('article_not_exists'); return;
} include_once(ROOT_PATH . '/includes/lib.editor.php');
if ($article['editor_type'] == 0)
{
$article['content'] = Editor::parse($article['content']);
} $this->assign('article', $article); /* 取得图片推荐商品 */
$_GET['sort'] = 'sort_weighing';
include_once(ROOT_PATH . '/includes/manager/mng.goods.php');
$mng_goods = new GoodsManager(0);
$condition = array(
'is_on_sale' => 1,
'is_mi_best' => 1
);
$this->assign('image_goods', $mng_goods->get_list(1, $condition, 6)); /* 取得文字推荐商品 */
$condition = array(
'is_on_sale' => 1,
'is_mw_best' => 1
);
$this->assign('words_goods', $mng_goods->get_list(1, $condition, 6)); /* 取得热销商品 */
$condition = array(
'is_on_sale' => 1,
'is_m_hot' => 1
);
$this->assign('sales_goods', $mng_goods->get_list(1, $condition, 10)); /* 当前位置 */
$this->assign('location_data', array(
array('name' => $article['title'])
)); $this->set_title(array($article['title'])); $this->display('site_news', 'mall');
}
}
?>
解决方案 »
- $_GET传值问题,高手帮帮忙!
- 求指教 请教教我吧 在线等。。。。
- php如何在表单没提交之前获取文本框的值
- css设置问题,谢谢了
- php如何访问object
- ==============================小偷程序==========================================================================================
- 本公司急需一个商城的购物系统(功能如下),价格不是问题,本人在上海(有具体联系方式)
- 帮帮忙,谁有用PHP+Oracle写的分页程序,谢谢
- 用户验证的问题--在Apache服务器上可以,而IIS4上不可以?
- 求助,php生成 json数据结构的问题
- webservice 学习,在线等
- 语句的效率问题??大家帮忙看看~~
加入
/******* 这是为了得到文章分类增加的begin*******/$this->assign('calling_news_type', $this->get_news_type($tid)); //文章分类
$this->assign('article_news_all',$this->get_all_news(9)); // 得到最新新闻9条数
$this->assign('get_site_news',$this->get_site_news(44,9)); // 得到专题新闻
/******* 这是为了得到文章分类增加的 end *******/
加入以上代码后, 不能解析出图片;
注释掉加入的这些代码, 解析正常从代码中可以看到, UBB解析应该在 Editor::parse($article['content']);求高手解?
这个应该是你数据库里面读出来的,是不是插入时候没有正确的editor_type
在我加入的代码前加入输出 print_r($article);输出在顶部的正常;内容还是没有解析过程
你加入分类的内容以后不能正常解析,原因可能是破坏了原来的ubb结构,或者正则不够严密不能解析,这个得从你加入分类内容以后的内容仔细分析一下.