title: Concatenate HTML in controller
body: <p>I am working on search data, and want to send HTML from controller to view with AJAX. I am getting syntax error. Here is my code.</p>
  
  <pre><code>function search()
  {
  
   $params['searchKeys'] = $this-&gt;input-&gt;post('query');
   $params['userID'] = $this-&gt;session-&gt;userdata('id');
  
   $storeArray   = $this-&gt;Store_model-&gt;searchStore($params);
   foreach($storeArray as $store){
  
    echo "&lt;div class='col-lg-3 col-md-4 col-sm-6 col-xs-12'&gt;
    &lt;div class='store-block'&gt;
    &lt;img class='img-responsive' src=".getImageURL($s['image'], array( 'alt' =&gt; '' ))."&gt;
    &lt;div class='overlay'&gt;
    &lt;h2&gt;".$s['storeName']."&lt;/h2&gt;".if($this-&gt;session-&gt;userdata('userType') == '2'):.
  
    .if($s['isBlocked'] == '1'):.
    "&lt;a class='info'&gt;Your store is blocked!&lt;/a&gt;
    ".else:."
    &lt;a class='info' href=".site_url('Store/preview/'.encode($s['storeID']))."&gt;Preview&lt;/a&gt;
    &lt;a class='info' href=".site_url('Slot/index/'.encode($s['storeID']))."&gt;Slots&lt;/a&gt;
    &lt;a class='info' href=".site_url('Booking/index/'.encode($s['storeID']))."&gt;Bookings&lt;/a&gt;
    &lt;a class='info' href=".site_url('Store/edit/'.encode($s['storeID']))."&gt;Edit&lt;/a&gt;
    &lt;a class='info' href='#'data-toggle='modal' data-target='#confirm-".$s['storeID']."&gt;Delete&lt;/a&gt;
    ".endif;."
  
    ".elseif($this-&gt;session-&gt;userdata('userType') == '1'):."
    &lt;a class='info' href=".site_url('Store/preview/'.encode($s['storeID']))."&gt;Preview&lt;/a&gt;
    ".if($s['isBlocked'] == '0'):.
    "&lt;a class='info' href='#' data-toggle='modal' data-target='#confirm-block-".$s['storeID']."&gt;Block&lt;/a&gt;
    ".else:."
    &lt;a class='info' href='#' data-toggle='modal' data-target='#confirm-unblock-".$s['storeID']."&gt;Un block&lt;/a&gt;
    ".endif.
    .endif."
    &lt;/div&gt;
    &lt;/div&gt;
    &lt;/div&gt;
    &lt;/div&gt;
    ";
  
  }
  exit;
  
  }
  </code></pre>
  
  <p>I am getting error on this line.   </p>
  
  <pre><code>&lt;h2&gt;".$s['storeName']."&lt;/h2&gt;".if($this-&gt;session-&gt;userdata('userType') == '2'):.
  </code></pre>