pug-php / pug

Pug template engine for PHP
https://www.phug-lang.com
MIT License
387 stars 42 forks source link

underscore prefixed names not recognized #48 #144

Closed glodov closed 7 years ago

glodov commented 7 years ago

It appears in version ^2.6.

I want to use page, when I use page it does work. I tried $page, does not help.

head
  title= __page.seo.title
  meta(charset='utf-8')

But it does work with __config.

      dl
        each value, key in __config

Do you have some predefined __ variables?

kylekatarnls commented 7 years ago

It will be far different in the next version but until 3.0, the expressions after = and in each, if, while, etc. are not handle in the same way. For now, if you have _ prefixed variables, you will need to write pure PHP to handle them with no risks:

// array
title=$__page['seo']['title']
// object
title=$__page->seo->title
glodov commented 7 years ago

Thanks, I just stick to non prefixed variables and it works ;)

kylekatarnls commented 7 years ago

I close this since it already works in https://github.com/phug-php/phug (our next engine), so it will be released on 3.0.0.