Jump to content


  • Posts

  • Joined

  • Last visited

  • Days Won


Everything posted by bernhard

  1. No. I just tried it again: // home.php <?php namespace ProcessWire; echo $rockfrontend->render("home.latte"); // home.latte <div id="markupregion">home.latte</div> // footer.latte <div id="markupregion"> original content </div> <section>I am the footer</section> Neither PW nor RockFrontend care about where the markup comes from. You just need to make sure that your region content is above the region markup. This is what it looks like when disabling $config->useMarkupRegions: You can even do that. Not sure if that's something that should be added to RockFrontend though. I'll add an entry to the WIKI... Here it is: https://github.com/baumrock/RockFrontend/wiki/RockFrontend-and-Markup-Regions#advanced-setup
  2. MagicPages (eg HomePage.php) do now also load the related CSS and JS files (eg HomePage.js and HomePage.css) in the backend page editor 😎 And there is a new WIKI page about MagicPages: https://github.com/baumrock/RockMigrations/wiki/MagicPages Magic Assets If your page is a MagicPage it will load YourPage.css and YourPage.js files automatically in the PW backend when editing any page of type YourPage. Example: // /site/classes/HomePage.php // /site/classes/HomePage.css div { outline: 2px solid red; } // /site/classes/HomePage.js alert('You are editing the HomePage');
  3. v2.0.4 improves deployment and thx to another 2 PRs by @gebeer docs and features of permission handling were improved πŸ™‚
  4. Yeah that's what I tried to explain. You don't need admin.less - you only need the module that adds the custom admin style in init() or ready() πŸ™‚ Now that I'm writing I realise that one can't customize my style once the module is installed. Because it won't pick up the admin.less file as it's overwriting this setting to use the module's style. That might be an improvement πŸ™‚
  5. Interesting need. I've stopped using MarkupRegions because it was more confusing than helpful for me. But you can use them with RockFrontend of course. RockFrontend does not care where the markup comes from and so does ProcessWire. So for example you could just render a latte file from your home.php file that holds the markup for the markup region and then in your main markup file (or any rendered LATTE file) you simply add that region and it will hold the content of the markup you put in home.php If that sounds confusing I'm sorry, but that's how it is when using markup regions πŸ˜„ // home.php <?php echo $rockfrontend->render("sections/home.latte"); // sections/home.latte <div id='foo'> <h1>{$page->title} - foo!</h1> </div> // _main.php <html> <body> <?= $rockfrontend->render('sections/main.latte') ?> </body> </html> // sections/main.latte <div>This is main latte</div> <div id="foo"></div> <div>End of main latte file</div> Does that make sense?
  6. Maybe we could join forces and extend my module with a simple toggle (light mode/dark mode)?
  7. Hey @flydev πŸ‘ŠπŸ» great to see another admin style coming up πŸ™‚ Check out https://github.com/baumrock/AdminStyleRock/ to see how you can create a module for 1-click-install without the need to copy files! This is all you have to add to your module: https://github.com/baumrock/AdminStyleRock/blob/30c91c9832ac8bc54fa64fbee416919824a1983d/AdminStyleRock.module.php#L35-L53
  8. No, I mean {$site->color = 'blue'} πŸ˜‰ which sets the "color" property of my site module to 'blue' and later I can echo that setting (also in other latte files!): <h1 style="color: {$site->color}">foo bar!</h1> {var ...} does only define a variable in the current latte file. That is a latte thing. What I tried to show is how you can use regular PHP. πŸ˜‰
  9. Hey @pmichaelis thx for the module. I've had some weird issues on my current project and tracked it down to the textformatter. Turned out that your module turned this: <p>xxx</p> Into that: <html><body><p>xxx</p></body></html> This is the fix that works for me: https://stackoverflow.com/a/22490902/6370411 I'll comment that on github if you want to fix this πŸ™‚ I don't think that the textformatter should add <html> and <body> to the markup, or was that intended?
  10. Would be interesting to see the difference (before/after) πŸ™‚πŸ˜‰ No. You can execute PHP code like {alfred($page)} or {bd('foo bar')} or assign new variables like {$site->color = 'blue'} but not much more..
  11. The whole thing about template engines is to avoid PHP πŸ˜‰ LATTE is different in that you can still use PHP (which I think is great!), because it actually compiles its templates to regular PHP files. So you can do a lot from within LATTE files, but not everything. So it depends what you want to do? You can't use foreach, if, else and such as PHP syntax. But for these things you have the latte equivalents and n:attributes. If you need lots of PHP in your template file you should maybe create a custom page class and put your PHP code in a dedicated method there, that you can then reference in your latte file: <p>{$page->outputSomething()}</p>
  12. To debug such things TracyDebugger is extremely helpful! You could have just dumped $page->hero_items to the debug bar: bd($page->hero_items) ...and you would have seen what $page->hero_items was and why your if/else did not work πŸ™‚
  13. Thx to @gebeer we now have support for repeater fields in the new version of RockMigrations 😎 If you find any other features that have been implemented in RM1 that are not yet in RM2 please let me know or even better create a PR πŸ™‚ Bumped version to 2.0.0 as I just realised that this version number fits better to how I'm referencing RM1 and RM2!
  14. Thx! I'm happy to hear that πŸ™‚ This is a completely recursive multi-level menu using LATTE + RockFrontend magic that should get you started πŸ™‚ <ul class="uk-nav uk-nav-primary uk-margin-top uk-margin-large-bottom"> {* define block that is used for recursion *} {define items, $items, $first} {foreach $items as $item}{* loop all items*} {* define variables for inside the loop *} {var $active = $rockfrontend->isActive($item)} {var $subid = "tm-menu-".$item->id} {var $numc = ($item->numChildren() && $item!==$first) } {* list item markup *} <li n:class="$active ? 'uk-active'"> <a href="{$item->url}" n:attr="rf-toggle: $numc ? '#'.$subid"> {$item->title} <svg n:if="$numc" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--tabler" width="20" height="20" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m6 9l6 6l6-6"></path></svg> </a> {* list for child-items *} <ul id="{$subid}" n:if="$numc" class="uk-nav-sub" {!$active?'hidden'}> {include items, $item->children()->prepend($item), $item} </ul> </li> {/foreach} {/define} {* now include the block for the first level of items *} {include items, $home->children()} </ul>
  15. https://www.google.com/search?q=site%3Aprocesswire.com+reset+password https://processwire.com/talk/topic/26189-reset-admin-password-or-add-superuser-rol/?do=findComment&comment=217769
  16. PM: "can we have the separator line not only on top of each list item but also after the last one?" <div n:foreach="$block->steps() as $step"> {$rockfrontend->render('img/hr.svg')} <div>...</div> {$rockfrontend->renderIf('img/hr.svg', $iterator->last)} </div> The $iterator is available automatically in LATTE loops! And it plays perfectly together with renderIf() 😎 See https://latte.nette.org/en/tags#toc-iterator
  17. In RepeaterPage on line 114 it tries to access the property "name" of some object. So you could do this one line above: if(!is_object($yourObjectVariable)) bd(Debug::backtrace()); // or this if(!is_object($yourObjectVariable)) throw new WireException("should be an object"); // or this if(!$yourObjectVariable instanceof Wire)) throw new WireException("should be instance of wire"); The backtrace should then maybe have some insights for us...
  18. @zoeck what is line 1282 of your version of RockMigrations? I guess it's a Windows issue as stat for "C" failed? Maybe I just forgot to do a normalizeseparators somewhere...
  19. Thx @MateThemes it's fixed in v1.6.8 PS: Why is RockMigrations placed in the "MagicPages" folder? Shouldn't that be "RockMigrations"??
  20. Hey @adrian I've built a module that provides a ->log('my data') method. In that method I check if tracy is installed and if so, the ->log('my data') call will not only write data to a logfile but should also dump that data to the tracy bar. That works of course, but the log now shows that it was called in MyModule.module.php instead of, eg _main.php Can I somehow tell the BD call what it should write here? Of course I could just do the bd() in the referencing file, but my ->log() method does more than just dumping data to the bar. Thx
  • Create New...