php - Kendo html string got formatted as html htmlentities -


Then I use PHP at the back end and how the string is created here:

  $ temporary ['photo'] = html_entity_decode ($ HTML formatted IMG);   

And in response it has been formatted:

  "photos": "& lt; img src = 'url / test1.jpg' & gt; ; & lt; IMG src = 'url / test2.png' & gt;   

and when I try to use it user:

  DataSourceDeals = new kendo.data.DataSource ({// serverPaging: true, ServerSurring: true, transport: {read: {url: crudServiceBaseUrlDeals + "read & businessId = {/ literal} {$ details.id} {literal } "," Datatype: "jsonp"}, update: {url: crudServiceBaseUrlDeals + "update and businessId = {/ literal} {$ details.id} {litterman}", data type: "jsonp"}, delete: { url: crudServiceBaseUrlDeals + "Deleted And businessman = {/ literal} {$ details.id} {literal} ", datatype:" Jsonp "}, create: {url: crudServiceBaseUrlDeals +" create and businessman = {/ literal} {$ details.id} {literal } {Data: "data", model: {id: 'id', field: {id: "data" type: "jsonp"},}, batch: incorrect, page size: 10, schema: {total: {type: "string"}, description: {type: "string"}, active: {type: "string"}, {type: "number", editable: incorrect}, dealName: {type: "string"}, photo: {type: "string"} "}}}}});   

And I got the result as a result of the text. When I try to inspect that text, I found it

  & amp; Lt; Img src = 'url / test1.jpg' & amp; Gt; & Amp; Lt; Img src = 'url / test2. Png '& amp; Gt;  

Edit

  $ ("# deals"). Kendo Grid ({Datasource: DatasourceDials, Page Lol: True, Reprocessing: Correct, Toolbar: [{Text: "Add Deal", Classname: "GridAddDeal"}, {text: "Edit Selected", Classname: "Grid Edit Height: 400, sorted: 'true', selectable: true, column: [[field: "id", title: "id", title: "idle"}, {text: "selected selected", classname: "griddialtedial"}] , Width: "40px"}, {field: "dealname", title: "coupon name", width: "100px"}, {field: "photo title:" active ", width:" "Field": "field", "width": "100px"}, {field: "description", title: "description", width: "100px"}, {field: "active", "70px"}]});    

Not sure that this is a flaw or a feature, but you can easily A template for the template as the photo field can be defined by the "# = photos #" :

  column: [ Field: "id", title: "id" width: "40px"}, {field: "dealname", title: "coupon name", width: "100px"}, {fee Title: "Details", width: "100px"}, {field: "active", "photo", title: "photo", width: "100px", "title": "description", title: "description" "Title": "Active", Width: "70px"}]   

See it here:

This is a feature from my perspective because it prints special characters The only way to be able to do this is by & lt; , & gt; , & amp; Without the need of a template it is understood that you probably will not send the HTML but some variable data which will generate HTML.

Alternatively, you can consider sending the URL of the photo as a comma-separated value photos: 'url /test1.jpg, url / test2.png' and then define a template:

  & lt; Script id = "photo-tpl" type = "text / kendo-tpl" & gt; # Var ps = data.photos.split (","); ## (var i = 0; i & lt; ps.length; i ++) {# & lt; Img src = "# = PS [i] #" /> #} # & Lt; / Script & gt;   

It is not easy to create HTML in the back-end, but at least this (from my view) is different from the Model-View-Controller's Clean.

Check out this approach here:

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -