Thursday, July 1, 2010

Re: Path for images etc

On Jul 1, 6:19 am, Sanfly <san...@gmail.com> wrote:
> Hi All
>
> It's been a long time since I've written any CakePHP, and even longer
> since Ive had to set up a server.  I know there is an answer to this
> somewhere but I cant for the life of me find it!  Also I have
> previously only used 1.1, and am now using the latest version
>
> On my WAMP server Im using for development, ive "installed" cake in a
> folder called "DSC"
>
> localhost
>     DSC
>         app
>         cake
>         vendors
>         etc...
>
> when I use my html helper in my default.ctp file to insert an image,
> the image does not display
>
> <?php echo $html->image('layout/dsc_01.png',array('border'=>'0',
> 'width'=>'17', 'height'=>'207')); ?>
>
> the path that comes back is a relative path, and goes too far back
>
> <img src="/DSC/img/layout/dsc_01.png" border="0" width="17"
> height="207" alt="" />
>
> the path shouldn't have the DSC

why not - in what way is it wrong/not working.
>
> <img src="img/layout/dsc_01.png" border="0" width="17" height="207"
> alt="" />

cake doesn't work like that. If it did it would mean the image works
only if you're a localhost/DSC/ not localhost/DSC or localhost/DSC/
somethingelse/ etc.
>
> What file do I need to edit to get the relative paths working
> correctly?

You won't ever get relative paths out of cake for assets.

AD

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

No comments: