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

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...