# \[SOLVED\] Convert syntax to Htmlhelper style

**URL:** <https://discourse.cakephp.org/t/solved-convert-syntax-to-htmlhelper-style/6228>\
**Category:** Need Help\
**Created:** [June 7, 2019, 7:35am UTC](https://discourse.cakephp.org/t/solved-convert-syntax-to-htmlhelper-style/6228 "2019-06-07T07:35:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![francisdoy](https://avatars.discourse-cdn.com/v4/letter/f/bcef8e/32.png) [@francisdoy](https://discourse.cakephp.org/u/francisdoy)\
**Post date:** [June 7, 2019, 7:35am UTC](https://discourse.cakephp.org/t/solved-convert-syntax-to-htmlhelper-style/6228/1 "2019-06-07T07:35:32Z")

</div>

Good day,

I need help converting the following line of code to Htmlhelper.  
`<li><a href="/"><i class="fa fa-book"></i> <span>List Articles</span></a></li>`

I only know how to add the controller and actions.  
`<li><?= $this->Html->link(__('List Articles'), ['controller' => 'Articles', 'action' => 'index']) ?></li>`

---

<div class="post-metadata">

**Author:** ![spadeX](https://avatars.discourse-cdn.com/v4/letter/s/919ad9/32.png) [@spadeX](https://discourse.cakephp.org/u/spadeX)\
**Post date:** [June 7, 2019, 11:02am UTC](https://discourse.cakephp.org/t/solved-convert-syntax-to-htmlhelper-style/6228/2 "2019-06-07T11:02:07Z")

</div>

`<li> <?= $this->Html->link("<i class="fa fa-book"></i> listOfArticales",["controller"=>"Articles","action"=>"index"]) ?> </li>`

Hope you enjoy this little help !!!

---

<div class="post-metadata">

**Author:** ![raul338](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/raul338/32/69_2.png) [@raul338](https://discourse.cakephp.org/u/raul338)\
**Post date:** [June 7, 2019, 1:03pm UTC](https://discourse.cakephp.org/t/solved-convert-syntax-to-htmlhelper-style/6228/3 "2019-06-07T13:03:56Z")

</div>

```php
<li> <?= $this->Html->link(
    '<i class="fa fa-book"></i> listOfArticales',
    ['controller' => 'Articles', 'action' => 'index'],
    [
        'escape' => false, // Allow HTML in the link content
        'target' => '....',
    ]
) ?> </li>

```

Everything that is not a reserved word will result in an attribute (eg. target, “data-…”, rel, etc)

---

<div class="post-metadata">

**Author:** ![francisdoy](https://avatars.discourse-cdn.com/v4/letter/f/bcef8e/32.png) [@francisdoy](https://discourse.cakephp.org/u/francisdoy)\
**Post date:** [June 8, 2019, 1:14am UTC](https://discourse.cakephp.org/t/solved-convert-syntax-to-htmlhelper-style/6228/4 "2019-06-08T01:14:45Z")

</div>

Thank you so much!  
This worked for me.  
`<li><?= $this->Html->link('<i class="fa fa-book"></i> <span>List Articles</span>', ['controller' => 'Articles', 'action' => 'index'], ['escape' => false]) ?></li>`

Marking this solved.
