topic.php
$id = isset($_GET['id']) ? intval($_GET['id']) : 0;
$query = mysql_query("SELECT * FROM topics WHERE id = $id");
$row = mysql_fetch_assoc($query);
$title = htmlspecialchars($row['title']);
$text = bbcode($row['text']);
view / topic.php
<h1><?=$title?></h1>
<p><?=$text?></p>
<h1>Replies</h1>
$q = mysql_query("SELECT * FROM replies WHERE topic_id = $id");
while ($r = mysql_fetch_array($q)) {
$text = bbcode($r['text']);
$date = $r['date'];
$poster = $r['poster'];
$edited = $r['edited'];
echo "<p>$text</p>";.......
}
As you can see I have some ugly code in the view / topic.php. Can I keep it in topic.php somehow? Not fun for a web designer to have to deal with all this.
Teşekkürler!