Repetable link ?helper?

I often and in many places in my app use link to order view. It’s always presented as clickable number leading to same controller/action/number. and generated by $this->Html->link.
My question is where I can/should put $this->Html->link(number,[‘controller’ => “Orders”, ‘action’ => “zamowienie”,number]) so I can call it in short form, for example echo $this->zam(number);
ps. using version 3.1

You can make your own helper, or you could put it in an element. But what you have there really isn’t so much code, I wonder whether it’s worth the bother to do so.

I would put it in a Helper.

I experience a huge benefit when moving even a small fragment like this into a helper. It gives my eye a way to quickly pass over this bit when scanning my templates without pausing to parse and determine its function.

The one downside is I have to remember what helpers methods I’ve written and what they’re called. But my IDE is providing hints to remind me.

1 Like

Thank guys! so I will teach my self to add a helper.
p.s. I looked in the doc and there is example: LinkHelper, so not only me is so lazy :wink: