Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undefined variable: _PAGE_ #118

Closed
immanuelfodor opened this issue Nov 13, 2020 · 4 comments
Closed

Undefined variable: _PAGE_ #118

immanuelfodor opened this issue Nov 13, 2020 · 4 comments
Labels

Comments

@immanuelfodor
Copy link

immanuelfodor commented Nov 13, 2020

Hi, my Shaarli master latest container logs are containing many of the following lines, it looks like something is not present in the header template that is being used. Maybe related to #117? I know you do some checks to avoid displaying the FAB on the add form, for example, but it's just a guess.

2020/11/13 04:53:51 [error] 11#11: *44 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined variable: _PAGE_ in /var/www/shaarli/tmp/page.header.c04e6db3e3da5484d981ebaa00b75abc.rtpl.php on line 3" while reading response header from upstream, client: 192.168.1.2, server: , request: "GET / HTTP/1.1" ...

@kalvn
Copy link
Owner

kalvn commented Nov 28, 2020

Hi @immanuelfodor, it is a variable I use to know what is the current page so that I don't display the add link button if it doesn't make sense.

@ArthurHoaro any idea how I could now do to detect current page identifier from within templates?

@kalvn kalvn added the bug label Nov 28, 2020
@kalvn kalvn mentioned this issue Nov 28, 2020
@ArthurHoaro
Copy link

Ah ah, this was a bug not a feature: shaarli/Shaarli#1551

More seriously, this variable was injected by the plugins manager and wasn't designed to be used in theme. So with a better code division, it's no longer accessible.

I can inject the template name (= filename) in the rendering function, so it would be accessible in included template files. It would be effective in the next release. Would that work for you?

@kalvn
Copy link
Owner

kalvn commented Dec 20, 2020

I found an alternative which is creating myself a variable in each template containing its name (example: https://github.com/kalvn/Shaarli-Material/blob/support-v012/material/linklist.html#L4).

So what you propose would totally work for me but if you prefer not to do it, I'm fine too :)

@immanuelfodor
Copy link
Author

I've rebuilt my Shaarli using the support-v012 branch, and now the PAGE related errors are gone. Thank you for the unnoticed changes in November :)

ArthurHoaro added a commit to ArthurHoaro/Shaarli that referenced this issue Jan 19, 2021
Use either legacy key _PAGE_ or new 'template' one.

Related to kalvn/Shaarli-Material#118
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants