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

use 'short echo tag' in generated output..? #894

Open
davidbuzz opened this issue Aug 10, 2023 · 4 comments
Open

use 'short echo tag' in generated output..? #894

davidbuzz opened this issue Aug 10, 2023 · 4 comments

Comments

@davidbuzz
Copy link

davidbuzz commented Aug 10, 2023

a lot of the generated php in the cache/php folder looks like this:
<?php echo 'xxxxx'; ?>
when it could be made more readable, and shorter by being like this:
<?='xxxxx'?>
... which is much shorter, and easier to read, and also makes the cached files a bunch shorter and so less disk acceses etc.
'short echo tag', ie <?= is enabled-by-default on all php since 5.4, and isn't related to then 'short open tag' any more.

I think it would be beneficial to move to to using htese shorter tags. .. or at least have it as an option when configuring smarty to decide what tags to use . ?
https://wiki.php.net/rfc/deprecate_php_short_tags_v2

@scottchiefbaker
Copy link

This would only work IF short tags were enabled at the PHP level. Most installations do not enable this. Also considering they've attempted to deprecated this twice now, I'm not in a hurry to start supporting it.

@wisskid
Copy link
Contributor

wisskid commented Aug 13, 2023

I believe the short echo tag is always available regardless of settings, since php 5.4.

That said, the upside of this change is very small. The generated php code isn't meant for easy reading (yet) and contains a lot more php code than just echo statements. Switching to the short echo tag won't do a lot to make it more readable.

In fact, it even makes it impossible to run adjecent blocks of php code together.

@davidbuzz
Copy link
Author

  • xdebug users will love it
  • less disk space/blocks/reads
  • easier migration to a php-based templating tool/s by using the php cache files

@lkppo
Copy link

lkppo commented Aug 16, 2023

These are penny-pinching savings.

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

4 participants