Giải thuật điều kiện để render newspaper

21 Jun 2021
0 Comments

                
                    
function inner($posts) {

    $buffy = '';
    $td_block_layout = new td_block_layout();

    $td_post_count = 0;

    if (!empty($posts)) {
        foreach ($posts as $post) {
            $td_module_flex_1 = new td_module_flex_1($post, $this->get_all_atts());
            $td_module_flex_3 = new td_module_flex_3($post, $this->get_all_atts());

            if ($td_post_count == 0) {
                $buffy .= $td_module_flex_1->render(__CLASS__);
            }
            if ($td_post_count == 1) {
                $buffy .= '<div class="td_module_column">';
                $buffy .= $td_module_flex_3->render(__CLASS__);
            }
            if ($td_post_count > 1) {
                $buffy .= $td_module_flex_3->render(__CLASS__);
            }
            $td_post_count++;
        }
        if ($td_post_count >= 2) {
         $buffy .= '</div>';
        }
    }
    $buffy .= $td_block_layout->close_all_tags();

    return $buffy;
}
                
            

Leave a Reply

This site uses cookies to offer you a better browsing experience. By browsing this website, you agree to our use of cookies.