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

Suggestion: {namspace} compile tag #1008

Open
SlowFox71 opened this issue May 2, 2024 · 0 comments
Open

Suggestion: {namspace} compile tag #1008

SlowFox71 opened this issue May 2, 2024 · 0 comments

Comments

@SlowFox71
Copy link

I experience quite frequently that class constants or enums have to be used in templates, e.g. in but not limited to if-conditions. These constants are typically located in namespaces.

Smarty templates for now reside in the root namespace, requiring to use absolute paths. Quite often all constants are from the same namespace, so that a {namespace} tag could make the template easier to handle, kind of this:

{namespace Foo\Bar\Baz}

{if $item->getSomeProperty() === ItemProperty::SomeValue}
   <p>this</p>
{elseif $item->getSomeProperty() === ItemProperty::SomeOtherValue}
   <p>that</p>
{elseif ...}
{else}
  <p class="warning">some property is not valid</p>
{/if}

{/namespace}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant