こんにちは私は、<div>
の中に<img>
タグを無効にしたいと思っています。theresの値が必要ないときにhtml divを無効にする
if(is_array($init) || is_object($init)){
foreach ($init as $data) {
echo '
<div id="profile-page-wall-post" class="card">
<div class="card-profile-title">
<div class="row">
<div class="col s1">
<img src="'.base_url('assets/images/'.$data->accounts_picture.'').'"
alt="" class="circle responsive-img valign profile-post-uer-image">
</div>
<div class="col s10">
<p class="grey-text text-darken-4 margin">'.$data->accounts_fname."\t".$data->accounts_lname.'</p>
<span class="grey-text text-darken-1 ultra-small">Shared publicly '.$data->post_date.'</span>
</div>
</div>
<div class="row center-align">
<div class="col s12">
<img class="Boxing image_attached" src="'.base_url('assets/files/'.$data->post_picture.'').'">
</div>
</div>
<div class="row">
<div class="col s12">
<p>'.$data->post_content.'</p>
</div>
</div>
<div class="row">
<div class="col s12">
<a href="'.base_url('assets/files/'.$data->post_file.'').'" download>'.$data->post_filename.'</a>
</div>
</div>
</div>
<div class="card-action row">
<div class="input-field col s8 margin">
<input id="profile-comments" type="text"
class="validate margin">
<label for="profile-comments" class="">
Comments
</label>
</div>
</div>
<div id="CommentSection" class="z-depth-1 col s12">
<div class="col s12">
<div class="card-panel grey lighten-5 z-depth-1">
<div class="row valign-wrapper">
<div class="col s2">
<img src="assets/images/def.jpg"
alt="" class="circle responsive-img">
</div>
<div class="col s10">
<p>Comment content</p>
</div>
</div>
</div>
</div>
</div>
</div>
';
}
}
私は$data->post_picture
がnullの場合、<img>
内部で<div>
を無効にしたかったです。これどうやってするの?
コードを書式設定し、文法とスペルの変更を加えました。 – Paul