The line of code that calls the image using the Html helper needs echo before 
it:

echo $this->Html->image('logo.png', $options=array());

I wouldn't hard code in paths to images; there's no point when you have the 
Html helper.

Jeremy Burns
Class Outfit

[email protected]
http://www.classoutfit.com

On 12 Apr 2011, at 13:49, varai wrote:

> merry_flowers project was baked inside wamp\www
> 
> The following is default.ctp in C:\wamp\www\merry_flowers\views
> \layouts
> 
> I have tried to display logo in plain html img src, within php (with
> echo ‘img src....’) and in cakephp format ($this->Html->image(.....))
> as you had suggested.  But none of them are displaying the image.
> 
> Does anyone know why i’m not able to display the logo.png?
> 
> The following is my code of default.ctp
> 
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
> www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml";>
> <head>
>       <?php echo $this->Html->charset(); ?>
>       <title>
>               <?php __('CakePHP: the rapid development php framework:'); ?>
>               <?php echo $title_for_layout; ?>
>       </title>
>       <?php
>               echo $this->Html->meta('icon');
> 
>               echo $this->Html->css('cake.generic');
> 
>               echo $scripts_for_layout;
>       ?>
> </head>
> <body>
>       <div id="container">
>               <div id="header">
>               <img src="../../webroot/img/logo.png" />
>               <?php
>               echo "<img src='../../webroot/img/logo.png' />";
>               $this->Html->image('logo.png', $options=array());
>               ?>
>               </div>
>               <div id="content">
> 
>                       <?php echo $this->Session->flash(); ?>
> 
>                       <?php echo $content_for_layout; ?>
> 
>               </div>
>               <div id="footer">
>                       <?php echo $this->Html->link(
>                                       $this->Html->image('cake.power.gif', 
> array('alt'=> __('CakePHP:
> the rapid development php framework', true), 'border' => '0')),
>                                       'http://www.cakephp.org/',
>                                       array('target' => '_blank', 'escape' => 
> false)
>                               );
>                       ?>
>               </div>
>       </div>
>       <?php echo $this->element('sql_dump'); ?>
> </body>
> </html>
> 
> 
> On Apr 11, 4:00 pm, "Krissy Masters" <[email protected]>
> wrote:
>> HTML helper
>> 
>> $this->Html->image('image_name.jpg', $options = array());?>
>> 
>> 
>> 
>> -----Original Message-----
>> From: [email protected] [mailto:[email protected]] On Behalf
>> 
>> Of varai
>> Sent: Monday, April 11, 2011 8:22 AM
>> To: CakePHP
>> Subject: placinglogoin layout.ctp
>> 
>> Hi
>> 
>> I'm new to cakephp and I'm trying to create my first project with
>> cakephp. I have already tried out the blog sample project.
>> 
>> Does anyone know on where and how to place thelogoimage in
>> layout.ctp?
>> 
>> I have already putlogo.png in /webroot/img.
>> 
>> Any help is much appreciated.
>> 
>> --
>> Our newest site for the community: CakePHP Video 
>> Tutorialshttp://tv.cakephp.org
>> Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help
>> others with their CakePHP related questions.
>> 
>> To unsubscribe from this group, send email to
>> [email protected] For more options, visit this group 
>> athttp://groups.google.com/group/cake-php- Hide quoted text -
>> 
>> - Show quoted text -
> 
> -- 
> Our newest site for the community: CakePHP Video Tutorials 
> http://tv.cakephp.org 
> Check out the new CakePHP Questions site http://ask.cakephp.org and help 
> others with their CakePHP related questions.
> 
> 
> To unsubscribe from this group, send email to
> [email protected] For more options, visit this group at 
> http://groups.google.com/group/cake-php

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to