foreach - How to concatenate string in php? -


how concatenate string in image source. try set base path dynamic in image source not work. using in fore each loop. body can me, give me suggestion. new in php.

here php code-

$base_path  =   'https://odesk.com';  $listing = ''; $count=1; if(sizeof($entry['contents'])>0){    foreach($entry['contents'] $child) {     $count++;     $cp = $child['path'];     $cn = basename($cp);     $image='';      $cp = htmlspecialchars($cp);     $link = getpath("?path=".htmlspecialchars($cp));      if ($child['is_dir'])      {      $image ='<img src="'@$base_path'/images/folder.png" width="20">';// want here add base path     $cn .= '/';     }else{     $image ='<input type="checkbox" value="'.$child['rev'].'" id="'.$child['rev'].'" name="checkbox_value[]" onclick="saveimages('.@$_session['products_id'].',`'.@$path.'`,`'.@$cn.'`,this.value,event)" class="checked">&nbsp;<img src="https://odesk.com/images/image_dropbox.png" width="15">';     }       if($count%2==0){     $listing .= "<div class='white'>$image&nbsp;<a id='a1' style='text-decoration: none;vertical-align:super;color:black;' href='$link'>$cn</a></div>";     }else{     $listing .= "<div class='white'>$image&nbsp;<a id='a1' style='text-decoration: none;vertical-align:super;color:black;' href='$link'>$cn</a></div>";     }  } }else{     $listing = "<div align='center' class='white'><span style='color:red; text-align:center;'>no folders & files available.</span></div>"; } 

we use . concatenating values in php.

replace following line

$image ='<img src="'@$base_path'/images/folder.png" width="20">';/ 

with

$image ='<img src="'.$base_path.'/images/folder.png" width="20">';/ 

Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -