我在我的博客上使用Processwire。
我知道我可以使用
调用博客发布循环<div class="blog_item">
<div class="clearfix"></div>
<div class="oi_blog_post_meta">
<div class="oi_blog_post_date">
<div class="oi_date_d colored">13 July
<span class="oi_year">2014</span>
</div>
<div class="oi_post_cat">
Java Script</div>
</div>
<h5 class="oi_blog_post_title">
<a href="quisque-consequat-felis-id-lorem-congue/index.html">Quisque Consequat Felis Lorem Congue </a>
</h5>
<div class="oi_post_descr_preview">
Proin sed odio eu turpis sagittis pretium a et metus. Quisque consequat tellus at dolor adipiscing viverra. Cras ligula lectus, viverra tempor ultrices sed, rhoncus quis nulla. Fusce adipiscing, velit nec sodales laoreet,</div>
</div>
<div class="oi_post_meta_data_holder">
<a class="oi_image_link" href="quisque-consequat-felis-id-lorem-congue/index.html">
<img class="img-responsive" src="
<?=$config->urls->templates;?>assets/wp-content//uploads/2014/07/photography-movement-13-600x600.jpg" alt="Quisque Consequat Felis Lorem Congue" />
</a>
<div class="oi_post_tringle"></div>
</div>
<div class="clearfix"></div>
</div>
</div>
index.php中的但我不知道如何在index.php中将html代码实现到我的blog_functions.php中。
有没有办法做到这一点?
function newsList(){
// Grab the page name from the url
$thisCategory = wire("page")->name;
// If the category is not called "news" then output the category name as a selector for the find.
if($thisCategory !="news") {
$category = "article_category.name=" . $thisCategory;
}
// Get the news posts - limited to ten for later pagination
$newsposts = wire("pages")->find("parent=/news-articles/, $category, template=TUT_news, limit=10");
$out =" ";
//Loop through the pages
foreach($newsposts as $newspost){
$out .="<div class='clearfix'>";
if($newspost->article_thumbnails){
$out .="<a href='{$newspost->article_thumbnails->url}' class=''>";
$out .="<img class='align_left' src='{$newspost->article_thumbnails->getThumb(listingthumb)}'>";
$out .="</a>";
}
$out .="<a href='{$newspost->url}'><h3>{$newspost->title}</h3></a>";
$out .="<p>{$newspost->article_introtext}</p>";
$out .="</div>";
}
// Pagination
$out .="<div class='pagination'>";
$out .= $newsposts->renderPager(array(
'nextItemLabel' => "Next",
'previousItemLabel' => "Prev",
'listMarkup' => "<ul>{out}</ul>",
'itemMarkup' => "<li>{out}</li>",
'linkMarkup' => "<a href='{url}'>{out}</a>"
));
$out .="</div>";
echo $out;
}
这是我的blog_functions.php
using Quobject.SocketIoClientDotNet.Client;
var socket = IO.Socket("http://localhost:3000");
socket.On(Socket.EVENT_CONNECT, () =>
{
socket.Emit("hi");
});
socket.On("hi", (data) =>
{
Console.WriteLine(data);
socket.Disconnect();
});
答案 0 :(得分:0)
回显PHP脚本中的HTML部分,浏览器将照常解析它。
<?php
echo "<html>
put html contents here.
</html>";
?>
照顾&#34;和&#39;将HTML与PHP混合。