Jump to content
php.lv forumi

Problēma ar PHP


MartiQ

Recommended Posts

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.

Link to comment
Share on other sites

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>';
Link to comment
Share on other sites

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.

 
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...