Jump to content

[solved] Error 500 using template cache because of missing less variables


herr rilke
 Share

Recommended Posts

hi @bernhard,

i have a new website online using rockpagebuilder 5.5.3

while in edit-mode as administrator everything works nicely. but activation template caching PLUS visiting the page while not logged in i get a server-error 500.

in PW exception log it reads

variable @global-secondary-background is undefined in file /site/templates/RockPageBuilder/blocks/CallToAction/CallToAction.less in CallToAction.less on line 23, column 14 21| .uk-background-primary { 22| h3 { 23| color: @global-secondary-background !important; 24| } 25| .text { 26| color: white;
In /site/modules/Less/wikimedia/less.php/lib/Less/Tree/Variable.php line 50

any ideas what went wrong?

 

Link to comment
Share on other sites

Hey @herr rilke that exception means that the variable is not defined. That's typically the case when you are using less files that contain uikit variables (like @global-secondary-background) but the uikit base files are not loaded. From what you write I'd try to check whether it is related to permissions or to caching. So you could try to activate only one at a time and check when it breaks. Then we know a little bit more.

Link to comment
Share on other sites

1 hour ago, bernhard said:

Hey @herr rilke that exception means that the variable is not defined. That's typically the case when you are using less files that contain uikit variables (like @global-secondary-background) but the uikit base files are not loaded. From what you write I'd try to check whether it is related to permissions or to caching. So you could try to activate only one at a time and check when it breaks. Then we know a little bit more.

i was looking for them by myself, couldn't figure out, where to look for them.
currently my base was your example RPB website.

Link to comment
Share on other sites

Hey @herr rilke thx for sending me the files.

The good news is that you can please mark this topic as [solved] here in the RockPageBuilder forum, because it is not related to RPB but rather to RockFrontend.

The bad news is that the way I designed RockFrontends assets feature does not reliably work with template cache at all. It works with no cache, it works with procache, but it doesn't work with template cache.

The problem is that with ProCache we get a 1:1 copy of the rendered page without calling any php files on the request. That's fine, because then all assets are already injected in the <head> and the browser just loads the static files.

If template cache is active it's different: Files like _init.php or layout.latte are not loaded and also not all the template php files, but all other php files like RockFrontend.module.php or RockPageBuilder.module.php are loaded. So it's a problem to place $rockfrontend->styles()->add(...) in files that are not loaded and other calls of styles()->add() in files that are. That's what you are seeing. RockPageBuilder assets are being loaded from RockPageBuilder.module.php but uikit files are not, because they are injected from _init.php or layout.latte or _main.php (wherever one might place it) which is skipped by template cache.

To be honest I'm not yet sure what to do about this as this would mean a major rewrite of all my projects and likely any project built on top of RockFrontend.

The easiest fix for your situation would be to just use ProCache, which is worth every cent.

If anybody has a good idea please let me know. I'll have to think about a good solution...

Link to comment
Share on other sites

  • herr rilke changed the title to [solved] Error 500 using template cache because of missing less variables

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