简体   繁体   中英

How can i split content into columns- separate divs- in yii view

i have a long content for now i have

 <p><?php   echo nl2br($model->content);  ?></p>

how can i split content longer than some defined length into multiple divs?

like this

    <div class="col1>this is some long content</div>
    <div class="col2>  and i mean realllllllly llloong content</div>

I think i can/should use pagination for this but i don't know how.

You can use str_split

<?php
$pages = str_split($model->content, 500);

foreach($pages => $page){
    echo '<div class="page">'.$page.'</div>';
}
?>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM