vendredi 26 février 2016

HTML parsing with relevant value in PHP

I have used Laravel 5.1 for my current project. In this project, I have a text area input field where user can insert HTML with predefined placeholder. Please take a look:

<div id="recommend">
  <div class="title"><p>Title</p></div>
    #{item}
  <div class="layout">
    <div class="item">
      <a href="#{url}" class="rcm11"><img border="0" alt="#{name}" src="#{image}"></a>
    </div>
    <div class="price">#{comma(price_tax)}</div>
  </div>
  #{/item}
</div>

I saved it to my database. when a user request a HTML, I have given this html by replacing placeholder with proper value. On the above HTML #{item}, #{url} etc. are place holders. I need to parse this place holders and replace with proper value. In Laravel or PHP, how can I do it? If anyone have a answer please let me know.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire