Discussion on ojsdao

0 views
Skip to first unread message

海逢 王

unread,
Mar 11, 2010, 10:02:46 PM3/11/10
to ojschina
ojs系统ArticleDAO的用法:
使用ArticleDAO来获取文章,代码如下:
1.根据文章id来获取文章
$articleDAO=&DAORegistry::getDAO('ArticleDAO');//获取ArticleDAO
$article=$articleDAO->getArticle($articleId);//更具articlleId来获取文章类
/* 获取文章信息,使用文章类方法来获取文章信息*/
$abstract=$article->getArticleAbstract();
$title=$article->getArticleTitle();

2.根据用户id号来获取文章
$articleDAO=&DAORegistry::getDAO('ArticleDAO');
/* 获取用户文章数组 */
$userArticles=$articleDAO->getArticlesByUserId($userId);//用户id
foreach ($userArticles as $userArticle){
$articles[]['title']=$userArticle->getArticleTitle();
$articles[]['abstract']=$userArticle->getArticleAbstract();
$articles[]['id']=$userArticle->getArticleId();
}

海逢 王

unread,
Mar 11, 2010, 10:16:09 PM3/11/10
to ojschina

Click on http://groups.google.com/group/ojschina/web/ojsdao - or copy
& paste it into your browser's address bar if that doesn't work.

Reply all
Reply to author
Forward
0 new messages