Powered by Invision Power Board



  Reply to this topicStart new topicStart Poll

> Problem with HtmlHelper::image()
peterhufo
Posted: Apr 7 2011, 09:14 PM
Quote Post


Newbie
*

Group: Members
Posts: 3
Member No.: 2775
Joined: 7-April 11



This code:

<?php echo $html->image('XXX-(white).png', array('alt' => 'XXX', 'height' => '50px', 'width' => '100px' ) ); ?>

produces:

<img src="/XXXadmin/img/'XXX-(white).png" alt="LBM" height="50px" width="100px" />

which does not find the image:

http://localhost/XXXadmin/app/webroot/img/XXX-(white).png.

The web page at http://localhost/XXXadmin/ is found but the $html->css() and $html->image() functions do not find the files.

Mac 10.6.6, CakePHP 1.3.8
Help!
PMEmail Poster
Top
peterhufo
Posted: Apr 7 2011, 10:19 PM
Quote Post


Newbie
*

Group: Members
Posts: 3
Member No.: 2775
Joined: 7-April 11



Well, this may be a browser problem. It works in FireFox 3.6.6 and Safari 3.2 but not in FF 4, safari 5.0 or Chrome 10.0.

Update later.
PMEmail Poster
Top
peterhufo
Posted: Apr 7 2011, 11:36 PM
Quote Post


Newbie
*

Group: Members
Posts: 3
Member No.: 2775
Joined: 7-April 11



These work.

Add this before the image name in the image() function "/app/webroot/img/"

Add this before the css name in the css() function /app/webroot/css/" AND add the extension ".css" to the file name.

I suspect that this is mentioned somewhere in the CakePHP documents. I am in a hurry to finish phase 1 of a project and the answer was not easy to find in the documentation.

ALSO, I had parentheses around part of the image name. That's a NO-NO! Replaced them with "%28" and "%29".
PMEmail Poster
Top
Oldskool
Posted: Apr 8 2011, 07:48 AM
Quote Post


Advanced Member
***

Group: Members
Posts: 46
Member No.: 2748
Joined: 23-March 11



You are still using CakePHP 1.2 syntax, try:

PHP Code
<?php
$this
->Html->image(...);
?>
PMEmail Poster
Top
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

Topic Options Reply to this topicStart new topicStart Poll

 

Disclaimer:
This forum is in no way affiliated with the Cake Software Foundation
The CakePHP name and icon is a trademark of the Cake Software Foundation


Lo-Fi Version