[ Поиск ] - [ Пользователи ] - [ Календарь ]
Полная Версия: нужна помощь
solomon1601
блок отвечает за пролистування страниц статей
При нажатии на новую страницу ( 2,3,4,) Дублируется список страниц и оглавление
Какие тут могут быть ошибки





unction BookChapter() {

if (isset($this->param['uid'])) {

$sql = 'select bc.name, bc.book_id, bc.id, b.is_short from '.$this->db_pref.'book_chapter bc, '.$this->db_pref.'book_title b where b.id = bc.book_id and uid='.intval($this->param['uid']);

$this->DB->query('update '.$this->db_pref.'book_chapter set cnt=cnt+1 where uid='.intval($this->param['uid']));

} else {

$sql = 'select name, id, book_id from '.$this->db_pref.'book_chapter where '.

'book_id='.intval($this->param['book_id']).' and id='.intval($this->param['chapter_id']);

$this->DB->query('update '.$this->db_pref.'book_chapter set cnt=cnt+1 where '.

'book_id='.intval($this->param['book_id']).' and id='.intval($this->param['chapter_id']));

}

//die($sql);

$spam = $this->DB->select($sql);

if ($spam[0]['is_short']==1) {

$this->param['id'] = $spam[0]['book_id'];

$out = '<style>li { display: inline;}</style>' . $this->BookItem();

} else $out = '';

$this->param['book_id'] = $spam[0]['book_id'];

$this->param['chapter_id'] = $spam[0]['id'];

$book = $this->DB->select('select ufu from '.$this->db_pref.'book_title where id='.intval($this->param['book_id']));

$out .= '<h5>'.$spam[0]['name'].'</h1>'.

'<p><a href="/'.($this->is_short==$this->page_id?'articles':'books').'/'.$book[0]['ufu'].'">Back</a></p>'.

file_get_contents('../images/book/'.intval($this->param['book_id']).'/'.intval($this->param['ch apter_id']).'.html');

if ($this->is_short == $this->page_id) {

$this->param['id'] = $this->param['book_id'];

$out = $this->BookItem().$out;

}

return $out;

}



function BookItem() {

$this->DB->query('update '.$this->db_pref.'book_title set cnt=cnt+1 where id='.intval($this->param['id']));

$book = $this->DB->select('select * from '.$this->db_pref.'book_title where id = '.intval($this->param['id']));

/*if ($book[0]['is_short']==1) {

$spam = $this->DB->select('select ufu from '.$this->db_pref.'book_chapter where book_id = '.intval($this->param['id']).' order by id limit 1');

header('Location: /books/'.$spam[0]['ufu']);

}*/


$this->smarty->assign('book_name', $book[0]['name']);

$this->smarty->assign('book_cnt', $book[0]['cnt']);

$this->smarty->assign('book_ufu', $book[0]['ufu']);



$sql = 'select * from '.$this->db_pref.'book_chapter where book_id = '.

intval($this->param['id']).' order by id';

$spam = $this->DB->select($sql);

for ($i=0, $j=count($spam); $i<$j; $i++) {

$this->smarty->append($spam[$i]);

}

return $this->smarty->fetch('book_'.($this->is_short==$this->page_id?'article':$this->tmpl).' _item.html');

}



function BookList1() {

$sql = 'select a.name as aname, b.id as bid, b.name as bname, b.cnt, b.ufu, b.is_short, (select ufu from '.$this->db_pref.'book_chapter bc where b.id=bc.book_id order by bc.id limit 1) as cufu from '.

$this->db_pref.'book_title b, '.$this->db_pref.'book_author a '.

'where a.id = b.author_id '.

(
isset($this->param['category_id'])?'and b.category_id='.intval($this->param['category_id']).' ':'').

(
$this->is_short==$this->page_id?'and is_short=1 ':' and (is_short=0 or is_short is null)').

'order by cnt desc'.

(
$this->limit>0?' limit '.$this->limit:'');



$spam = $this->DB->select($sql);

for ($i=0, $j=count($spam); $i<$j; $i++) {

//if ($spam[$i]['is_short']==1) $spam[$i]['ufu'] = $spam[$i]['cufu'];

$spam[$i]['cnt'] = intval($spam[$i]['cnt']);

$this->smarty->append($spam[$i]);

}

$this->smarty->assign('is_short', ($this->is_short-$this->page_id));

return $this->smarty->fetch('book_'.$this->tmpl.'_list.html');

}



function BookList() {

$sql = 'select a.name as aname, b.id as bid, b.name as bname, b.cnt, b.ufu from '.

$this->db_pref.'book_title b, '.$this->db_pref.'book_author a '.

'where a.id = b.author_id '.

(
isset($this->param['category_id'])?'and b.category_id='.intval($this->param['category_id']).' ':'').

(
$this->is_short==$this->page_id?'and is_short=1 ':' and (is_short=0 or is_short is null)').

'order by cnt desc'.

(
$this->limit>0?' limit '.$this->limit:'');



$spam = $this->DB->select($sql);

for ($i=0, $j=count($spam); $i<$j; $i++) {

$spam[$i]['cnt'] = intval($spam[$i]['cnt']);

$this->smarty->append($spam[$i]);

}

$this->smarty->assign('is_short', ($this->is_short-$this->page_id));

$out = $this->smarty->fetch('book_'.$this->tmpl.'_list.html');



if ($this->is_short!=$this->page_id) {

$smarty = new Smarty();

$smarty->compile_check = true;



$sql = 'select a.name as aname, b.id as bid, b.name as bname, b.cnt, b.ufu from '.

$this->db_pref.'book_title b, '.$this->db_pref.'book_author a '.

'where a.id = b.author_id '.

(
isset($this->param['category_id'])?'and b.category_id='.intval($this->param['category_id']).' ':'').

(
'and is_short=1 ').

'order by cnt desc'.

(
$this->limit>0?' limit '.$this->limit:'');

$spam = $this->DB->select($sql);

for ($i=0, $j=count($spam); $i<$j; $i++) {

$spam[$i]['cnt'] = intval($spam[$i]['cnt']);

$smarty->append($spam[$i]);

}

$smarty->assign('is_short', 0);

$smarty->assign('dont_head', 1);

$out .= $smarty->fetch('book_'.$this->tmpl.'_short.html');

}



return $out;




Спустя 12 минут, 48 секунд (3.05.2012 - 18:53) walerus написал(а):
solomon1601 Отредактируй свой пост, возьми "код" в теги php, что ьбы наглядно было видно что куда, такое ощущение что газету читаю..

Спустя 52 минуты (3.05.2012 - 19:45) solomon1601 написал(а):
зделал......

Спустя 3 часа, 4 минуты, 1 секунда (3.05.2012 - 22:49) sewer написал(а):
какие идеи???? хто небуть.

Спустя 32 минуты, 22 секунды (3.05.2012 - 23:22) m4a1fox написал(а):
Откуда код?

Спустя 10 часов, 43 минуты, 29 секунд (4.05.2012 - 10:05) Michael написал(а):

 ! 

М
Давайте своим темам вменяемое название. Закрываю.
Michael
Быстрый ответ:

 Графические смайлики |  Показывать подпись
Здесь расположена полная версия этой страницы.
Invision Power Board © 2001-2024 Invision Power Services, Inc.