Mod rewrite is used so that Cake can "fake" folders on the server (as
the browser sees it).
example.com/ - The browser things you are in the root folder on the
server.
example.com/pages/home - The browser things you are in the pages
folder on the server.
example.com/pages/home/ - The browser things you are in the pages/home
folder on the server.
Sounds like you have added html to app/webroot/index.php to style your
application. This is not a very good idea. For a start that html has
no idea which "fake folder" Cake is showing the browser. As so anytime
you navigate around the app all references to css, javascript and
images will "change" relative to the perceived location.
The above explanation of mod rewrite is ass backwards as a general way
to understand the feature. I was trying to illustrate how static html
in a browser sees relative and absolute paths. Nothing more.
Check out the folder app/views/layouts/. Here you can add any wrapping
html you want in a much more Cake-friendly way. From there you can
also use Cake's helpers to link to images and other assets in a way
that will not break no matter what.
/Martin
On Jun 2, 1:11 am, DbZeroOne <dbzero...@gmail.com> wrote:
> Hello all,
>
> I've found myself thrust into a project that the previous developer
> made using CakePHP. I'm a little familiar with PHP, but it's taken me
> a couple days to figure out how Cake works.
>
> Anyway, I have what seems to be a very simple question, but it's
> driving me crazy! My question is..."Where do the images go?!"
>
> The directory on my server ishttp://localhost/mydomain.com/testing/app/webroot
> which is common, I think.
>
> My images folder is in webroot as is my index.php.
>
> I've wrapped the code in index.php with some design elements which
> looks fine as long as I'm on index.php page. Once I click a link, the
> PHP part generates itself a URL that doesn't really exist, but it
> works fine. The problem is that the images in the wrapper no longer
> work. EVERYTHING works fine, but the images ONLY work on webroot/
> index.php.
>
> I've tried putting them in every folder I could think of, I've looked
> deeply into the files to see if there was some config somewhere and
> I've searched all over the 'net to find an answer and nothing seems to
> address this exact situation.
>
> By the way, mod_rewrite is on.
>
> Is there some way I can say "Always find images <here>, regardless of
> what URL is generated"?
>
> I apologize for my ignorance.... one day I'll be an expert! :) Thank
> you!
--~--~---------~--~----~------------~-------~--~----~
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:
Post a Comment