Forum > Networking and Web Programming

fpweb/weblaz questions.

<< < (2/3) > >>

BSaidus:
Thank you for help & information.
I'll try and see.

BSaidus:
I constat that fcl-mustache do not come for fpc3.2.2

Leledumbo:

--- Quote from: BSaidus on April 14, 2023, 09:42:31 am ---I constat that fcl-mustache do not come for fpc3.2.2

--- End quote ---
Yes, it's a little bit too late. 3.2.2 was released on May 2021, which already has feature frozen a couple of months before. The first commit to fcl-mustache happend in April 2021. However, the package itself compiles fine with 3.2.2, so if you have to stick with it, you can just grab the folder or even just the unit (only fpmustache.pas matters, unless you need the expression parser / dataset extension).

BSaidus:
thanks @Leledumbo

BSaidus:
Please help.
Given this json data

--- Code: Javascript  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---{  "host":{    "name"     : "uc1.uccenos.net",    "ip"       : "123.33.32.1",    "mask"     : "222.222.222.0",    "gateway"  : "123.33.23.3"   }}  and this template with expression

--- Code: Text  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---<br/><ul>  <li>hostnam : {{host.name}}   </li>  <li>ip      : {{host.ip}}     </li>  <li>mask    : {{host.mask}}   </li>  <li>gateway : {{host.gateway}}</li> <select name="themask">'    <option value="111.222.333.111" {{[IF((comparetext(mask,'111.222.333.111')=0), 'selected','')]}}> 111.222.333.111 </option>    <option value="222.222.222.0"     {{[IF((comparetext(mask,    '222.222.222.0')=0), 'selected','')]}}> 222.222.222.0   </option>      <option value="333.222.333.111" {{[IF((comparetext(mask,'333.222.333.111')=0), 'selected','')]}}> 333.222.333.111 </option> </select> 
I have tried all combinaisons but do not work

--- Code: Text  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} --- // Combinaisons tried  <option value="222.222.222.0"     {{[IF(comparetext(mask,    '222.222.222.0')=0, 'selected','')]}}> 222.222.222.0   </option>  <option value="222.222.222.0"     {{[IF(comparetext(mask,    '222.222.222.0')=0, 'selected','')]}}> 222.222.222.0   </option>  <option value="222.222.222.0"     {{[IF(mask='222.222.222.0', 'selected','')]}}> 222.222.222.0   </option>    the lazarus code is :

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TForm1.FormCreate(Sender: TObject);begin  //fpMus := TMustache.Create(Self);  fpMusEx := TMustacheExpr.Create(Self);  fpMusEx.RegisterVariables(mmJson.Text, 'host');     // mmJson = memo that containe the json dataend; procedure TForm1.Button1Click(Sender: TObject);begin  fpMusEx.Template := mmTemp.Text;                       // mmTemp = memo that containe template data.  mmRes.Text := fpMusEx.Render(mmJson.Text);end;  
Heeeeeelp please.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version