Skip to content
This repository has been archived by the owner on Feb 8, 2019. It is now read-only.

HtmlHelper array params #21

Open
ponyjoy opened this issue Jan 7, 2014 · 1 comment
Open

HtmlHelper array params #21

ponyjoy opened this issue Jan 7, 2014 · 1 comment

Comments

@ponyjoy
Copy link

ponyjoy commented Jan 7, 2014

in the template file:

<a href = "{{ html.url({'controller' : 'category', 'action' : 'edit'}) }}"> Edit </a>

render ==>

<a href = "/category/edit"> Edit </a>

It's right.

<a href = "{{ html.url({'controller' : 'category', 'action' : 'edit', 'id' : 1}) }}"> Edit </a>

render ==>

<a href = "/category/edit/id:1"> Edit </a>

this is not desirable, I need like this:

<a href = "/category/edit/1"> Edit </a>

so I change it to

<a href = "{{ html.url({'controller' : 'category', 'action' : 'edit', 1}) }}"> Edit </a>

got error:
A hash key must be followed by a colon (:). Unexpected token "punctuation" of value "." ("punctuation" expected with value ":")

in ctp view file, we can use like this:

echo $this->Html->url(array('controller' => 'category', 'action' => 'edit', 1));

How to resolve it ?

@mchiron
Copy link

mchiron commented Mar 27, 2014

You should be able to use a numeral as the key instead of nothing.

<a href = "{{ html.url({'controller' : 'category', 'action' : 'edit', '0' : 1}) }}"> Edit </a>

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants