Advertisement
arijulianto

Insert Image Inside Posting

Oct 24th, 2014
289
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.31 KB | None | 0 0
  1. <?php
  2. $arrContent = explode('<p>', $data['content']);
  3. if(count($arrContent)>=3){
  4.     foreach($arrContent as $i=$content){
  5.         if($i==1){
  6.             echo '<p><img src="images/',$data['gambar'],'" /></p>';
  7.         }
  8.         echo '<p>',$arrContent[$i];
  9.     }
  10. }else{
  11. echo '<p><img src="images/',$data['gambar'],'" /></p>',$data['body'];
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement