D
D
Danila2015-09-28 14:37:58
Yii
Danila, 2015-09-28 14:37:58

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>";
}
?>

And now the question to the connoisseurs. What do you think, what can be done so that the post is not in the form of a crooked standard post vp, but turns right into html / css. (everything is drawn and ready)
In general, there are ideas how, when adding a new post, it was displayed on the front beautifully as a ready-made template for posts. (that is, I wrapped the post from the vp into the finished css / html code)
P.s. forgive my clumsy and not very correctly formulated question, I have not slept for the second day.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Korolev, 2015-09-28
@lega111

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 question

Ask a Question

731 491 924 answers to any question