Jump to content

RockFrontend and TracyDebugger


zoeck
 Share

Recommended Posts

Hello @bernhard,

as posted in the other thread, I tried adding the Latte Tracy Bar to RockFrontend.

Just Added this to the RockFrontend.module.php:

// Top of the Module add the LattePanel Class
use Latte\Bridges\Tracy\LattePanel;

 

// Add inside the "protected function renderFileLatte($file, $vars)"
// After "$latte = new Engine();" add this to initialize the LattePanel

if($this->modules->isInstalled("TracyDebugger"))		
	LattePanel::initialize($latte);

After that you have the LattePanel in Tracy 😉 

latte.png.d5096a23c0f9d187c6b0bf25d13cd609.png

I have not been able to detect any problems so far.

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

Hey @zoeck thx! 

I've added it to the latest version 🙂 

Only thing to mention is that this:

0VEBr7C.png

Will result in only showing "header.latte" in the bar:

0Pk80AV.png

In order to make it work you need to render default.latte instead of default.php:

l3r9C3D.png

4KkHDZp.png

Nice!

The problem here is though that we are losing nice RockFrontend features like "renderIf(...)" and there is no early exit feature in latte at the moment 😞 

  • Thanks 1
Link to comment
Share on other sites

@zoeck I wonder if it could make sense to make our own debug panel for RockFrontend that keeps track of all $rockfrontend->render() calls (and also renderIf)?!

Is the latte debug panel helpful for you as is? I think for me it has more drawbacks than benefits. What are actually the benefits other than to get a list of rendered latte files?

  • Like 1
Link to comment
Share on other sites

10 hours ago, bernhard said:

What are actually the benefits other than to get a list of rendered latte files?

The panel is quite interesting if you have a latte project, with layouts, different sections etc. - This makes it easy to see which files are being used.

I think I use RockFrontent differently than you do 😄 
Actually, I mainly use the standard functions of Latte as described in the documentation, without "extensions" of RockFrontend (But I use the styles/script functions 😉).

Of course, this may also have something to do with the fact that I'm still using latte for the first project.

What real drawbacks do you see in the panel? Apart from the fact that it doesn't fit so well with your workflow

I think I need to take a closer look at the panel again

Link to comment
Share on other sites

2 hours ago, zoeck said:

The panel is quite interesting if you have a latte project, with layouts, different sections etc. - This makes it easy to see which files are being used.

Yeah I understand that and I agree, but I was asking for benefits other than that? I thought there are maybe other benefits as well 🙂 

2 hours ago, zoeck said:

I think I use RockFrontent differently than you do 😄 
Actually, I mainly use the standard functions of Latte as described in the documentation, without "extensions" of RockFrontend (But I use the styles/script functions 😉).

I'm always happy to hear that (1) anybody is using my modules at all and even better (2) if they are using it differently and (3) share their findings so that I can see other approaches 🙂 

I could use {include ...} instead of $rockfrontend->render(...), but the non-existing early exit is really a show-stopper for me. Do you have any other approach to that?

2 hours ago, zoeck said:

What real drawbacks do you see in the panel? Apart from the fact that it doesn't fit so well with your workflow

I don't see a drawback with the panel (that's why I added it). It's just the missing renderIf() or early exit feature that I lose when using {include ...}. But using {include ...} is necessary to get a meaningful latte panel.

2 hours ago, zoeck said:

I think I need to take a closer look at the panel again

I'm looking forward to hearing what you find out 🙂 

  • Like 1
Link to comment
Share on other sites

55 minutes ago, bernhard said:

I could use {include ...} instead of $rockfrontend->render(...), but the non-existing early exit is really a show-stopper for me. Do you have any other approach to that?

I honestly haven't even been thinking about it, but I actually had a case where I used this - without "renderIf".
But this is actually more of a workaround, as I simply include an empty latte file (the "blank.latte" file is displayed in the Tracy Panel)

{include $pages->find("template=test")->count() ? "test.latte" : "blank.latte"}

I think that is "a bit renderIf" in latte syntax 😉 
Two templates have to be specified at all times, otherwise an error will be displayed.
It would be very cool if it would also work with a single template...

1 hour ago, bernhard said:

but I was asking for benefits other than that?

I think currently you only have this benefit 😄 

  • Like 1
Link to comment
Share on other sites

On 1/10/2023 at 10:27 AM, bernhard said:

It's just the missing renderIf() or early exit feature that I lose when using {include ...}. But using {include ...} is necessary to get a meaningful latte panel.

Looks like there is an exitIf node now 😉
But it seems there will be no include with condition and only one template 😞 

{if $foo == 'bar'}{include 'somefile.latte'}{/if}

 

  • Like 1
Link to comment
Share on other sites

  • 4 months later...

Hey @zoeck I've updated an older site to the latest version of RockFrontend (+116 commits 😅 ) and got this error, which is caused by the LattePanel:

EiWTFAq.png

The API docs say that ::initialize is deprecated: https://api.nette.org/latte/master/Latte/Bridges/Tracy/LattePanel.html

But no idea why this is a problem on this installation since all other projects are also running on php8.1 and don't complain? Any ideas?

Link to comment
Share on other sites

23 hours ago, bernhard said:

Any ideas?

Currently, I barely use Processwire for the frontend, since I am implementing a larger project with vue.js
when i have some time, i will have a look at the problem with the tracy panel.

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...