Wednesday, 15 September 2010

Insert HTML into php CakePHP -



Insert HTML into php CakePHP -

i've downloaded script , working on on localhost. problem never worked or used php before, neither cakephp. new me. know html, css , javascript (can read/understand php). it's hard understand cakephp , how works. i've been waching , reading books cakephp , still don't found how this.

the script comes menu. i've edited things match requirements fail adding tags between php tags. understand more, here original code:

echo $this->html->link(__('home'), array('admin'=>false, 'plugin'=>null, 'controller'=>'events', 'action'=>'index'));

and here want do/implement:

<!-- <ul> <li><a href="">home<em class="glyphicon glyphicon-ok-circle"></em></a></li> <li><a href="">users<em class="glyphicon glyphicon-ok-circle"></em></a></li> <li><a href="">profile<em class="glyphicon glyphicon-ok-circle"></em></a></li> <li><a href="">mesages<em class="glyphicon glyphicon-ok-circle"></em></a></li> </ul> -->

and made till now:

<ul>echo '<li>';html->link(__('home'), array('admin'=>false, 'plugin'=>null, 'controller'=>'events', 'action'=>'index'));echo '</li>';

output:

<ul><li><a href="">home</a></li></ul>

should be: (final result)

<ul><li><a href="">home<em class="glyphicon glyphicon-ok-circle"></em></a></li></ul>

and here problem/issue (don't know how implement this):

<em class="glyphicon glyphicon-ok-circle"></em>

i've tried concatenate, doesn't worked (example):

echo $this->html->link(__('home').'<em></em>', array('admin'=>false, 'plugin'=>null, 'controller'=>'events', 'action'=>'index'));

output (the em tags output plain text, not html tags):

<a href="">home<em></em></a>

any suggestions/hels much appreciated. give thanks you.

you need "escape" property @ false not escape html tags

should :

<?php echo $this->html->link(__('home').'<em></em>', array('admin'=>false, 'plugin'=>null, 'controller'=>'events', 'action'=>'index'), array('escape' => false)); ?>

cake cookbook htmlhelper: http://book.cakephp.org/2.0/en/core-libraries/helpers/html.html

look @ :

htmlhelper::link(string $title, mixed $url = null, array $options = array(), string $confirmmessage = false)

(hope help, sorry english)

php html cakephp

No comments:

Post a Comment