Thanks Brian. I created a folder in webroot that leads to my pdf. It works great!
Just on a side note, is this a standard way of doing this, creating additional folder structures in the webroot? I was just under the impression that all this was supposed to be done in the views folder. Thanks! justclint On Feb 8, 10:45 pm, brian <bally.z...@gmail.com> wrote: > Oh, I thought you meant it was a direct link to the PDF. Which your > link appears to be. But your controller action seems to be trying to > render the PDF. Do you have a route set up for > "health_questionaire.pdf" to point to > YourController::health_questionnaire()? Unless you've overloaded > render() in some funky fashion, that's not going to work. If you want > Cake to feed the PDF file, have a look at MediaView.[1] > > But, if you just need a direct link to a PDF file, the URL should > point to wherever the file is relative to the webroot dir (eg > /fitness_lab/forms/health_questionnaire.pdf if the file is in > app/webroot/fitness_lab/forms dir). Just make sure it's below webroot. > MediaView can serve files that are parked above webroot, btw (ie > inaccessible to normal requests). > > [1]http://api.cakephp.org/class/media-view > > On Mon, Feb 9, 2009 at 12:39 AM, justclint <justcl...@gmail.com> wrote: > > > Thanks for replying Brian. Actually I had a wrong link in there but > > after fixing it I dont get the error message anymore. Now it just > > renders my index page while the url still end in .pdf. > > > In my controller I got this: > > > function forms() { > > $this->pageTitle = 'Fitness Lab : Forms'; > > $this->set('page', 'forms'); > > $this->set('pageName', 'Forms'); > > $this->render('/fitness_lab/forms/index'); > > }// end forms() > > > function health_questionnaire() { > > $this->pageTitle = > > 'Fitness Lab : Forms : Health > > Questionnaire'; > > // set page info > > $this->set('page', > > 'forms'); > > > > $this->set('pageName', 'Health Questionnaire'); > > // set view file > > > > $this->render('/fitness_lab/forms/health_questionnaire.pdf'); > > }// end > > health_questionnaire() > > > Im not using a mode since the content is static. > > > In my views folder I have fitness_lab/forms. > > > My link in fitness_lab/forms/index looks like this > > > <a href="health_questionaire.pdf"> > > <?=$html->image('/img/logos/pdficon_small.gif', > > array('class' => > > 'pdficon')); ?></a> > > > If it helps heres a url to the page im working on. > > >http://www.networkfitness.com/nf_dev/fitness_lab/forms/ > > > You can see that when you click on the download a form link that the > > url displays correctly but the page does not render the pdf file. > > > Thanks! > > > justclint > > > On Feb 8, 9:18 pm, brian <bally.z...@gmail.com> wrote: > >> I guess the obvious questions are, what does your link URL look like, > >> and what's in this error.php file at line 25? > > >> Shouldn't that be app_error.php, btw? > > >> On Mon, Feb 9, 2009 at 12:01 AM, justclint <justcl...@gmail.com> wrote: > > >> > Everything I've seen doing a search on google and in this group seems > >> > to be based on converting files/views to pdf. > > >> > I have pdf files that I just need to link to. I keep getting this > >> > parse error when I click on the link to the pdf file: > > >> > Parse error: syntax error, unexpected ';', expecting T_FUNCTION in / > >> > data/15/1/101/96/1753748/user/1895223/htdocs/nf_dev/app/error.php on > >> > line 25 > > >> > Is there a way to just link to existing pdf files? > > >> > Thanks! > > >> > justclint --~--~---------~--~----~------------~-------~--~----~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---