PHPooooomosht
3 отговора
143 прегледа
PHPooooomosht
това е част ос скрипт която определя кой статии от БД да бъдат показани - става перфектно !!!
Обаче някой може ли да ми каже какво трябва да променя за да пропуска първата статия ? просто да започва да ги показва от втората нататък...
ето го и кода
/**
* Fetches articles from the database, and prepares them for display.
*
* @param integer (optional) the article id to the article to be displayed.
*
* @return void
*
* @access private
*/
function renderArticles( $article_id = 1, $num_items = 0 )
{
$this->item_count = 1;
if( $article_id <= 0 )
{
$catid = (isset( $_GET['cat_id'] )) ? $_GET['cat_id'] : 0;
$start = (isset( $_GET['start'] )) ? $_GET['start'] : 0;
if( $num_items > 0 ) {
$this->data->setItemCount( $num_items );
}
else {
$this->data->setItemCount( $this->config['news_item_num'] );
}
$articles = $this->data->fetchArticles( 0, $catid, $start );
$this->item_count = $this->data->fetchArticlesCount( 0, $catid );
}
else
{
$start = (isset( $_GET['start'] )) ? $_GET['start'] : 0;
$articles = $this->data->fetchArticle( $article_id );
$this->renderComments( $article_id, $start );
}
$this->prepareArticles( $articles, ($article_id <= 0) );
}
Моля ви помогнете на юзърката
Обаче някой може ли да ми каже какво трябва да променя за да пропуска първата статия ? просто да започва да ги показва от втората нататък...
ето го и кода
/**
* Fetches articles from the database, and prepares them for display.
*
* @param integer (optional) the article id to the article to be displayed.
*
* @return void
*
* @access private
*/
function renderArticles( $article_id = 1, $num_items = 0 )
{
$this->item_count = 1;
if( $article_id <= 0 )
{
$catid = (isset( $_GET['cat_id'] )) ? $_GET['cat_id'] : 0;
$start = (isset( $_GET['start'] )) ? $_GET['start'] : 0;
if( $num_items > 0 ) {
$this->data->setItemCount( $num_items );
}
else {
$this->data->setItemCount( $this->config['news_item_num'] );
}
$articles = $this->data->fetchArticles( 0, $catid, $start );
$this->item_count = $this->data->fetchArticlesCount( 0, $catid );
}
else
{
$start = (isset( $_GET['start'] )) ? $_GET['start'] : 0;
$articles = $this->data->fetchArticle( $article_id );
$this->renderComments( $article_id, $start );
}
$this->prepareArticles( $articles, ($article_id <= 0) );
}
Моля ви помогнете на юзърката
Re: PHPooooomosht
неможах да разбера много от тази част на скрипта... :) дай малко повече... това някакъв фрии скрипт ли е !? ако е дай направо линк да го свалим и да го видим...
Re: PHPooooomosht
На бързо око :
$start = (isset( $_GET['start'] )) ? $_GET['start'] : 1;
е те така може и да стане
root@localhost#cd /pub
root@localhost#more beer
$start = (isset( $_GET['start'] )) ? $_GET['start'] : 1;
е те така може и да стане
root@localhost#cd /pub
root@localhost#more beer