Thanks Brian. That helps a lot. The only thing Ive been using webroot
for was just images and my ccs and js. I didnt realize it was meant to
be (literally) the webroot. This is the first MVC framework I've used.

Well my forms finally link correctly now.

However I did notice one little detail. It doesnt bother me, I dont
need to fix it but I just thought Id throw this out there.

I noticed that if I had a directory in my views like:

/fitness_lab/forms (forms being a folder with views in it)

then I could not make the same directory in the webroot. I had to
change it to:

/fitness_lab/form (no 's').

Brian, thanks again for all your help!

justclint



On Feb 9, 6:23 pm, brian <[email protected]> wrote:
> You don't need the controller serve PDFs unless you have some reason
> to keep them inaccessible to casual browsers and want to use some kind
> of authorisation. In that case, you'd want to look at MediaView.
> Otherwise, just let Apache serve it as any other file. Hence, you put
> it under webroot. Anything that's under that directory is accessible
> with a direct link--images, javascript, CSS files, etc. So, you can
> create whatever directory structure you want in there if you have
> reason to.
>
> Perhaps the confusion stems from the fact that the HtmlHelper has a
> method to create image links. But, if you look carefully, you'll see
> that the URL points directly to the image file under webroot, not a
> controller. I think that maybe the only reason $html->image() exists
> is because too many people were becoming confused by Cake's mysterious
> DOCUMENT_ROOT shuffling (I was) that they were messing up their img
> links.
>
> To answer your other question about the views dir, all those files in
> there are basically templates for displaying a controller's output.
> That's not the webroot, but simply a convenient directory in which to
> store template files. What mscdex was suggesting is, if you happened
> to have a controller action where you wanted to redirect the request
> to somePDFfile, you'd use the public URL as the param to redirect().
> Something like
>
> $this->redirect('/fitness_lab/forms/health_questionnaire.pdf');
>
> But I'm pretty sure that's not what you're after here. Just leave the
> controller out of it.
>
> On Mon, Feb 9, 2009 at 8:01 PM, justclint <[email protected]> wrote:
>
> > Thanks mscdex. Your 2nd suggestion is exactly what Im trying to do.
> > Brian suggested adding the directory to webroot which works as
> > intended.
>
> > However, I did have the pdfs in a the views folder and I tried the
> > redirect() but I run into the same problem trying to define what the
> > controller and action would be for apdffile.
>
> > How would I use this redirect to show thepdffile?
>
> > Thanks!
>
> > justclint
>
> > On Feb 8, 10:08 pm, mscdex <[email protected]> wrote:
> >> Generally if you are manually rendering a view, you should do: 
> >> $this->autoRender = false;
>
> >> If you are trying to get thePDFto show up instead of the controller
> >> action's view, you could try doing a $this->redirect() as documented
> >> here:http://book.cakephp.org/view/425/redirect
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to