zoeck Posted May 26 Share Posted May 26 I think you have to pass the variable to your included latte file: {include '../blocks/' . $block->type . '.latte', block: $block} 1 Link to comment Share on other sites More sharing options...
wbmnfktr Posted May 26 Share Posted May 26 10 hours ago, bernhard said: It should work just like any other PW api... Does it render empty divs? Does it throw an exception? I receive the markup but couldn't access any data somehow. 10 hours ago, bernhard said: I'm never using {include ...}, I'm always using {$rockfrontend->render(...)}, but both should work. Using $rockfrontend every time wouldn't save me that much time so I tried using it the .latte way. 10 hours ago, zoeck said: I think you have to pass the variable to your included latte file This did the trick. Thanks for this hint! Link to comment Share on other sites More sharing options...
artfulrobot Posted May 31 Share Posted May 31 On 7/19/2022 at 3:37 PM, bernhard said: <ul> <li n:foreach="$page->parents()->add($page) as $item"> <a href="{$item->url}" n:tag-if="$item->id != $page->id"> {$item->title} </a> </li> </ul> If it's ok to dig up old threads.... @bernhard here, aren't you double encoding url, title? Assuming this is front end code, with `$pages->of(true)` and you have html entities text formatter in place on your title, url fields then a title with - say - an & would come out looking like & as it would actually be &amp; Link to comment Share on other sites More sharing options...
bernhard Posted June 1 Author Share Posted June 1 20 hours ago, artfulrobot said: @bernhard here, aren't you double encoding url, title? Assuming this is front end code, with `$pages->of(true)` and you have html entities text formatter in place on your title, url fields then a title with - say - an & would come out looking like & as it would actually be &amp; I think you are right for the ->title, but not for the ->url. The url is a property of the page object, not a regular field. So there is no textformatter applied and therefore it should just work like shown in the example. If you have a textformatter applied on the title field, then you'd need a |noescape filter in latte, yes. 1 Link to comment Share on other sites More sharing options...
Greg Lumley Posted June 23 Share Posted June 23 @bernhard I absolutely love Rockfrontend and latte, it's so intuative!! The only issue I'm having is bracket pair colours in Visual Studio Code. Is there a way to get VSC to highlight the brackets and div pairs in a *.latte file? I'm sure there must be, I can't seem to find anything online. Link to comment Share on other sites More sharing options...
bernhard Posted June 23 Author Share Posted June 23 Hey @Greg Lumley great to hear that, thx 🙂 There is a latte extension for VSCode. It's not perfect, but it's ok: Also there is no proper intellisense/code completion in latte files which is a pity, but I try to keep my latte files as clean as possible and put all the logic in the custom page class or in my Site.module.php so latte files are really just some simple markup and calling {$obj->method()} which is something that I can manage without typos most of the time 😄 Link to comment Share on other sites More sharing options...
Greg Lumley Posted June 23 Share Posted June 23 @bernhard Thank you. I am using that extension. I'll be sure to follow your guidelines regarding logic as I move forward. Greg 1 Link to comment Share on other sites More sharing options...
Recommended Posts