<?php
if (isset($d)) {
foreach ($d as $row) {
$val = $row["id"];
$cont = trimContent($row);
echo '<div class="post-preview">
<a href="index.php/post/'.$val.'">
<h2 class="post-title">'.$row["Title"].'</h2>
<h5 class="post-subtitle">'.$cont.'</h5>
</a><p class="post-meta">Posted on '.$row["Date"].'</p>';
echo "<p>Tags: ";
$dat = fetchTag($conn, $val);
if (isset($dat)) {
foreach ($dat as $row2) {
$tagidval = $row2["tid"];
echo '<a href="http://localhost/MVC/index.php/tag/'.$tagidval.'">'.$row2["tname"].' </a>';
}
echo "</p>";
}
echo "<p>Categories: ";
$dat = fetchCategory($conn, $val);
if (isset($dat)) {
foreach ($dat as $row2) {
$tagidval = $row2["cid"];
echo '<a href="http://localhost/MVC/index.php/category/show/'.$tagidval.'">';
echo $row2["cname"]." ";
}
echo "</p>";
}
echo "</div>
<hr>";
}
}
?>
我不想在此php标记内调用函数,该标记是HTML标记。我把php部分放在这里作为参考。它实际上是一个博客索引页面,其中显示了标题和受关注的细节。它实际上可以正常工作,但是我需要在不调用html页面内部函数的情况下使用相同的东西,以将代码转换为MVC模式