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

Support Named Argument when execute function #889

Closed
ampmonteiro opened this issue Jul 8, 2023 · 1 comment
Closed

Support Named Argument when execute function #889

ampmonteiro opened this issue Jul 8, 2023 · 1 comment

Comments

@ampmonteiro
Copy link

In sequence of issue #888
this is not possible with smarty:

{form_open('news/delete',  hidden:['news_id' => {$news['id']}]) nofilter}
        <button>Delete</button>
{form_close() nofilter}

i am using php 8.0 feature called Named Arguments, in this case hidden name parameter and give me this error:

image

Even that @wisskid said in #888 :

Well, Smarty is not PHP. Although the syntax is clearly inspired by PHP, their syntaxes differ greatly. Thus, I would not consider this a bug, but it might be considered as a new feature.

And in smarty requiremts:

Requirements: Smarty can be run with PHP 7.1 to PHP 8.2.

however it is not fully compatible with few new features like Named Arguments which should be mention in the docs.

I still didn't try this with twig but tried with Nette/Latte template which works perfectly fine:

    {form_open(
        'news/delete',
        hidden: ['news_id' => esc($news['id'])]
    )|noescape}

you can see my full code here

@wisskid
Copy link
Contributor

wisskid commented Aug 5, 2023

Again, Smarty is not PHP. The fact that Smarty can be run with PHP 7.1 to PHP 8.2 does not mean that the Syntax of Smarty is equal to the syntax of PHP. It is not, in many respects. There are some PHP language constructs that also work in Smarty and vice versa, but the similarities are in fact very limited.

Support for named arguments was suggested in #864 and is still open for consideration.

@wisskid wisskid closed this as completed Aug 5, 2023
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

2 participants