MartiQ Posted March 1, 2013 Report Posted March 1, 2013 Sveiki, tātad veidoju lapeli un apstājos vienā vietā... Man ir 3 kolonnu lapa. 1. kolonna ir jaunumu lapa, kura patreiz nestrādā, varbūt kāds zina, kas šeit par problēmu? <?php if( is_array( $topics ) AND count( $topics ) > 0 ) { echo '<div class="news">'; foreach( $topics as $topic) { $topicurl = topic_url( $topic['tid'], $topic['title_seo'] ); $html = str_get_html($topic['post']); $first_image = !empty( $html->find('img', 0)->src ) ? $html->find('img', 0)->src : ROOT_URL . '/assets/img/first-page-image.jpg' ; ?> <div class="news-entry clearfix"> <div class="image"> <div class="image-holder"> <img src="<?php echo $first_image;?>" alt="" /> </div> <a class="read-news" href="<?php echo $topicurl?>">LASĪT VISU</a> </div> <div class="post"> <div class="title"><?php echo htmlspecialchars( $topic['title'] )?></div> <div class="meta">Rakstu izveidoja: <a href="<?php echo member_url_short( array( 'member_id' => $topic['member_id'], 'members_seo_name' => $topic['members_seo_name'] ) ) ?>"> <?php echo $topic['author_name']?> </a> | Komentāri: <a href="<?php echo $topicurl?>#fast_reply_wrapper">4</a> | <a href="<?php echo $topicurl?>#fast_reply_wrapper">Pievienot komentāru</a> </div> <div class="text"> <?php echo $topic['post'] ?> </div> </div> </div> <?php } echo '</div>'; } ?> Izņemot PHP kodu ārā, HTML teksts parādās, bet protams tas man neder.. Ja atstāj šādi, tad vispār nekas neparādās.. Kas varētu būt pie vainas? Cieņā, MQ. Quote
rpr Posted March 1, 2013 Report Posted March 1, 2013 Kļūdu paziņojumi ieslēgti? kaut kā nemanu str_get_html() definīciju. kā arī beigās var pielikt else { echo 'nav topiku'; } Quote
404 Posted March 1, 2013 Report Posted March 1, 2013 Debugošanas triecienalgoritms: 1) Nokomentēt 2,3,41 rindiņu 2) Ja Invalid argument supplied for foreach() tad meklē vainu iekš $topics satura 3) Iekš cikla: echo '<pre>'; print_r($topic); echo '</pre>'; Quote
MartiQ Posted March 1, 2013 Author Report Posted March 1, 2013 Liels paldies, sapratu, ka neesmu ievietojis pēc definīcijas pareizi nosaukumu. Vai jūs varētu, lūdzu, pateikt, ko nozīmē šīs divas līnijas? $sql = $this->ipbwi->ips_wrapper->DB->query('SELECT tid FROM '.$this->ipbwi->board['sql_tbl_prefix'].'topics WHERE title="' . addslashes(htmlentities($title)) . '" AND tdelete_time="0"'); $sql = $this->ipbwi->ips_wrapper->DB->query('SELECT title FROM '.$this->ipbwi->board['sql_tbl_prefix'].'topics WHERE tid="'.intval($id).'"'); Man tieši interesē, ko nozīmē addslashes(htmlentities($title)) intval($id) Cieņā, MQ. Quote
daGrevis Posted March 1, 2013 Report Posted March 1, 2013 http://php.net/manual/en/function.addslashes.php http://php.net/manual/en/function.htmlentities.php http://php.net/manual/en/function.intval.php Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.