Answer the question
In order to leave comments, you need to log in
Post output: Yii front-end, Wordpress back-end?
Hello.
Asked a similar question already, but there was an integration.
I did it all, universal scale crutches, + one local crutch for "php multi-threading, as it were."
The question is. The same customer, the same news portal.
Made the output of posts, (add a post in the wp admin panel, then yii picks up from the database and displays in the desired section)
<?php
$category = "5";
$results = Yii::app()->db->createCommand()->
select('object_id')->
from('be_term_relationships')->
where('term_taxonomy_id='.$category)->
order('object_id DESC')->
queryAll();
foreach ($results as $key => $value) {
$postid = $results["$key"]["object_id"];
$postinfo = Yii::app()->db->createCommand()->
select('post_content,post_title')->
from('be_posts')->
where('ID='.$postid)->
queryAll();
$postinfo = array_shift($postinfo);
$postpreview = Yii::app()->db->createCommand()->
select('guid')->
from('be_posts')->
where('post_parent='.$postid.' AND post_type="attachment" AND post_mime_type="image/jpeg"')->
queryAll();
$postpreview = array_shift($postpreview);
echo "<p class='in' style='font-size: 30px; padding: 20px'><a href='article/".$postid."'>".$postinfo["post_title"]."</a></p>";
if (isset($postpreview)) {
echo "<img src='".$postpreview["guid"]."'>";
}
echo "<p>".$postinfo["post_content"]."</p>";
echo "<div class='wrapper'>";
echo "</div>";
}
?>
Answer the question
In order to leave comments, you need to log in
If I understand correctly what you actually want to achieve, try using some template engine.
For example, we are currently using the Mustache approach in one WP project, and all templates are stored in the database.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question