0

I want to simplify my life and instead of using every time <?php echo $text->title ?> I want to use {%title} and get the same result. How am I supposed to do this?

I don't want necessarily this expression but something like.

Billal Begueradj
  • 20,717
  • 43
  • 112
  • 130
zaBogdan
  • 21
  • 1
  • 5
  • I would advise AGAINST using PHP short tags because in a nutshell; they don't work reliably. See this article for more information: https://stackoverflow.com/questions/200640/are-php-short-tags-acceptable-to-use. Using `=$title?>` is fine though. If you really prefer to use custom tags, why not use something like `Twig`, `Blade` or any other `PHP templating engine`? – BRO_THOM Jan 03 '19 at 14:27
  • 1
    Use a templating system like Twig. https://twig.symfony.com/ – ceejayoz Jan 03 '19 at 14:27
  • 1
    @BRO_THOM In all current versions of PHP, `=` is supported even if short tags are turned off. `` is problematic; `=` is not. – ceejayoz Jan 03 '19 at 14:28

1 Answers1

1

You can use a short expression of echo.

<?=$text->title?>

Also,

In your php.ini change the short_open_tag = Off if it's there to this:

short_open_tag = On
Sayed Mohd Ali
  • 2,156
  • 3
  • 12
  • 28