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

Check compatability of empty, reset, current, end, prev, next and isset in v5 #988

Open
wisskid opened this issue Apr 7, 2024 · 4 comments

Comments

@wisskid
Copy link
Contributor

wisskid commented Apr 7, 2024

Smarty v4 has special handling for empty, reset, current, end, prev, next and isset in certain contexts. Check if behavior is consistent in v5.

@gueff
Copy link

gueff commented Aug 18, 2024

I want to upgrade from Smarty v4.5.3 => to v5.* in my PHP Framework https://emvicy.com/ on branch 2.x (https://github.com/emvicy/Emvicy/tree/2.x) and Smarty in v5.4.0 gives me this kind of error.

example

<code>
  /* array $aToolbar.aPathParam */
  {if true === empty($aToolbar.aPathParam)}
	  ...true....
  {else}
	 ...false...
  {/if}
</code>

error

Syntax error in template "string: [..]  on line 287 
"{if true === empty($aToolbar.aPathParam)}" unknown modifier 'empty'

I could not find any help on this specific topic yet (looked after also in https://smarty-php.github.io/smarty/stable/upgrading/#removed-smarty-api-methods)

So - How to handle or rewrite those kind of template code to get it work in Smarty 5 ?

@wisskid
Copy link
Contributor Author

wisskid commented Aug 18, 2024

@wisskid wisskid closed this as completed Aug 18, 2024
@wisskid wisskid reopened this Aug 18, 2024
@gueff
Copy link

gueff commented Aug 20, 2024

Thank you for your answer, but unfortunately it doesn't really help me. I had already read that native php functions are no longer supported and that plugins should be registered instead (and I'm not happy about that).

I am very familiar with the use of plugins etc. in Smarty. The question I am asking is a bit different.

I do need such expressions as shown below in templates.
How can or must this logical expression be noted in a Smarty template in the future:

formerly

{if true === empty($aVar)} ... {/if}

future ?

{if true === ($aVar|emptyModifier)} ... {/if}

I had not found anything about this. Sorry for my perhaps unclear previous formulation.

@wisskid
Copy link
Contributor Author

wisskid commented Aug 22, 2024

You shouldn't have to change your templates at all.

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