ZF3 > Docs > Getting Started > Templates & Request Handlers


#1

https://docs.zendframework.com/zend-expressive/v3/getting-started/quick-start/#creating-request-handlers

I’m working my way through the Expressive docs, modifying the skeleton app. At the end of Getting Started > Quick Start you should be able to toggle between

* http://localhost:8080/hello    // 'Hello World'
* http://localhost:8080/hello?target=ME    // 'Hello ME'

I just get ‘Hello’ for both. I may just be missing something simple (probably), but I can’t figure it out.

The docs template code is

<h1>Hello <?= $this->target ?></h1>

but I installed Plates when installing the skeleton app (as recommended in the docs) and the Plates syntax is

<h1>Hello, <?=$this->e($target)?></h1>

I tried this though and it doesn’t work either. I don’t get an error message it just doesn’t work.

Here’s my version of the code (seemingly identical to the docs code unless I’ve mistyped something): https://github.com/obwansan/zend-expressive-skeleton

I’ll carry on working through the docs, but if anyone has time to have a look and advise me I’d appreciate it.


#2

The first one is for zend-view. However this should work for plates: <h1>Hello <?= $this->e($target); ?></h1>.
I just downloaded your repo, changed the hello template and it works.


#3

I’ve just created a PR to add example code for plates, zend-view and twig: https://github.com/zendframework/zend-expressive/pull/631


#4

Thanks very much for checking this so quickly. I’ve just tried it again with
<h1>Hello <?= $this->e($target); ?></h1>
and it works now…don’t know why it didn’t before, but glad that my problem resulted in an improvement to the docs.