Re: [fw-general] Zend_Layout - images and css not loading
On 01/02/2008, Matthew Weier O'Phinney <[EMAIL PROTECTED]> wrote: > > -- Peter Atkins <[EMAIL PROTECTED]> wrote > (on Friday, 01 February 2008, 12:17 PM -0800): > > I apologize that was my typo > > > > > > > > /> > > Home > > > type="text/css" /> > > > > > > > > > > . > > > > I wish that was it... > > > > I do see the following two errors: > > > > HP Fatal error: Uncaught exception > 'Zend_Controller_Dispatcher_Exception' > > with message 'Invalid controller specified (css)'... > > PHP Fatal error: Uncaught exception > 'Zend_Controller_Dispatcher_Exception' > > with message 'Invalid controller specified (images)' > > Okay, this sounds like one of two things: > > * Either the css and image files are not under your public directory, > OR > * You've got a bad rewrite rule, and *all* files are getting routed to > the front controller instead of omitting static content > > What does your rewrite rule look like? Is it the one from the > documentation: > > RewriteRule !\.(js|ico|gif|jpg|png|css)$ index.php > > Also, what happens when you visit the file linked to in the source of your generated HTML page? Best, -- Vincent
Re: [fw-general] Zend_Layout - images and css not loading
Not a solution to the problem, but rather a note, you should be using baseUrl(). Like: $this->view->headLink()->appendStylesheet($this->getRequest()->getBaseUrl() . '/css/lib.css'); And if you are adding it in the view, then I've found this helper BaseURL() by Geoffrey Tran to be very useful: http://www.spotsec.com/blog/archive/2007/12/14/zend-framework-baseurl-view-helper/ I use it like this (in the view): $this->headLink()->appendStylesheet($this->baseUrl('/css/lib.css')); Cheers, - Amr On Feb 1, 2008 10:39 PM, Matthew Weier O'Phinney <[EMAIL PROTECTED]> wrote: > -- Peter Atkins <[EMAIL PROTECTED]> wrote > (on Friday, 01 February 2008, 12:17 PM -0800): > > I apologize that was my typo > > > > > > > > > > Home > > > type="text/css" /> > > > > > > > > > > . > > > > I wish that was it... > > > > I do see the following two errors: > > > > HP Fatal error: Uncaught exception 'Zend_Controller_Dispatcher_Exception' > > with message 'Invalid controller specified (css)'... > > PHP Fatal error: Uncaught exception 'Zend_Controller_Dispatcher_Exception' > > with message 'Invalid controller specified (images)' > > Okay, this sounds like one of two things: > > * Either the css and image files are not under your public directory, > OR > * You've got a bad rewrite rule, and *all* files are getting routed to > the front controller instead of omitting static content > > What does your rewrite rule look like? Is it the one from the > documentation: > > RewriteRule !\.(js|ico|gif|jpg|png|css)$ index.php > > > > > On Feb 1, 2008, at 11:50 AM, Matthew Weier O'Phinney wrote: > > > >> -- Peter Atkins <[EMAIL PROTECTED]> wrote > >> (on Friday, 01 February 2008, 11:34 AM -0800): > >>> This is my first post to the list, and also my first project with ZF. > >>> > >>> I'm trying to implement Zend_Layout with all the MVC elements outside of > >>> the public doc root. This also includes the new layout templates (I also > >>> tried with templates in pub tree). > >>> > >>> This issue I'm having is that the "css" and/or "images" are not > >>> displaying. > >>> I have an image call in the base.phtml template and I'm trying to load > >>> the > >>> css from the indexController using ... > >>> > >>> $this->view->headLink()->appendStylesheet('/css/lib.css'); > >>> > >>> It produces the proper code: >>> rel="stylesheet" type="text/css" /> > >> > >> Wait -- where did the leading '/' go? That could very well be the issue, > >> as without the leading slash, the browser is going to look in the path, > >> which could likely contain a /controller/action/ string... leading to a > >> 404 for the file. > >> > >> appendStylesheet() shouldn't be trimming this off, nor should headLink() > >> be removing it when rendering itself. You're sure you're adding it with > >> the leading slash? > >> > >>> They are located in the pub tree see below: > >>> > >>> File locations > >>> /application/controller/* > >>> /application/models/* > >>> /application/views/* > >>> /application/views/layouts > >>> /application/views/layouts/basic > >>> /application/views/layouts/basic/basic.phtml // basic layout template > >>> > >>> Base file content: > >>> > >>> > >>> > >>>headTitle() ?> > >>>headLink() ?> > >>>headScript() ?> > >>>headStyle() ?> > >>> > >>> > >>> > >>> // not displaying > >>> > >>> > >>>render('header.phtml') ?> > >>>placeholder('nav') ?> > >>>layout()->content ?> > >>>render('footer.phtml') ?> > >>> > >>> > >>> > >>> /public_html/images/logo.gif > >>> /public_html/css/lib.css > >>> /public_html/index.php // bootloader > >>> > >>> > >>> Any thoughts would be great, I'm sure I'm missing something simple. > >> > >> -- > >> Matthew Weier O'Phinney > >> PHP Developer| [EMAIL PROTECTED] > >> Zend - The PHP Company | http://www.zend.com/ > > > > > > -- > Matthew Weier O'Phinney > PHP Developer| [EMAIL PROTECTED] > Zend - The PHP Company | http://www.zend.com/ >
Re: [fw-general] Zend_Layout - images and css not loading
-- Peter Atkins <[EMAIL PROTECTED]> wrote (on Friday, 01 February 2008, 12:17 PM -0800): > I apologize that was my typo > > > > > Home > type="text/css" /> > > > > > . > > I wish that was it... > > I do see the following two errors: > > HP Fatal error: Uncaught exception 'Zend_Controller_Dispatcher_Exception' > with message 'Invalid controller specified (css)'... > PHP Fatal error: Uncaught exception 'Zend_Controller_Dispatcher_Exception' > with message 'Invalid controller specified (images)' Okay, this sounds like one of two things: * Either the css and image files are not under your public directory, OR * You've got a bad rewrite rule, and *all* files are getting routed to the front controller instead of omitting static content What does your rewrite rule look like? Is it the one from the documentation: RewriteRule !\.(js|ico|gif|jpg|png|css)$ index.php > On Feb 1, 2008, at 11:50 AM, Matthew Weier O'Phinney wrote: > >> -- Peter Atkins <[EMAIL PROTECTED]> wrote >> (on Friday, 01 February 2008, 11:34 AM -0800): >>> This is my first post to the list, and also my first project with ZF. >>> >>> I'm trying to implement Zend_Layout with all the MVC elements outside of >>> the public doc root. This also includes the new layout templates (I also >>> tried with templates in pub tree). >>> >>> This issue I'm having is that the "css" and/or "images" are not >>> displaying. >>> I have an image call in the base.phtml template and I'm trying to load >>> the >>> css from the indexController using ... >>> >>> $this->view->headLink()->appendStylesheet('/css/lib.css'); >>> >>> It produces the proper code: >> rel="stylesheet" type="text/css" /> >> >> Wait -- where did the leading '/' go? That could very well be the issue, >> as without the leading slash, the browser is going to look in the path, >> which could likely contain a /controller/action/ string... leading to a >> 404 for the file. >> >> appendStylesheet() shouldn't be trimming this off, nor should headLink() >> be removing it when rendering itself. You're sure you're adding it with >> the leading slash? >> >>> They are located in the pub tree see below: >>> >>> File locations >>> /application/controller/* >>> /application/models/* >>> /application/views/* >>> /application/views/layouts >>> /application/views/layouts/basic >>> /application/views/layouts/basic/basic.phtml // basic layout template >>> >>> Base file content: >>> >>> >>> >>>headTitle() ?> >>>headLink() ?> >>>headScript() ?> >>>headStyle() ?> >>> >>> >>> >>> // not displaying >>> >>> >>>render('header.phtml') ?> >>>placeholder('nav') ?> >>>layout()->content ?> >>>render('footer.phtml') ?> >>> >>> >>> >>> /public_html/images/logo.gif >>> /public_html/css/lib.css >>> /public_html/index.php // bootloader >>> >>> >>> Any thoughts would be great, I'm sure I'm missing something simple. >> >> -- >> Matthew Weier O'Phinney >> PHP Developer| [EMAIL PROTECTED] >> Zend - The PHP Company | http://www.zend.com/ > > -- Matthew Weier O'Phinney PHP Developer| [EMAIL PROTECTED] Zend - The PHP Company | http://www.zend.com/
Re: [fw-general] Zend_Layout - images and css not loading
I apologize that was my typo Home type="text/css" /> . I wish that was it... I do see the following two errors: HP Fatal error: Uncaught exception 'Zend_Controller_Dispatcher_Exception' with message 'Invalid controller specified (css)'... PHP Fatal error: Uncaught exception 'Zend_Controller_Dispatcher_Exception' with message 'Invalid controller specified (images)' On Feb 1, 2008, at 11:50 AM, Matthew Weier O'Phinney wrote: -- Peter Atkins <[EMAIL PROTECTED]> wrote (on Friday, 01 February 2008, 11:34 AM -0800): This is my first post to the list, and also my first project with ZF. I'm trying to implement Zend_Layout with all the MVC elements outside of the public doc root. This also includes the new layout templates (I also tried with templates in pub tree). This issue I'm having is that the "css" and/or "images" are not displaying. I have an image call in the base.phtml template and I'm trying to load the css from the indexController using ... $this->view->headLink()->appendStylesheet('/css/lib.css'); It produces the proper code: Wait -- where did the leading '/' go? That could very well be the issue, as without the leading slash, the browser is going to look in the path, which could likely contain a /controller/action/ string... leading to a 404 for the file. appendStylesheet() shouldn't be trimming this off, nor should headLink() be removing it when rendering itself. You're sure you're adding it with the leading slash? They are located in the pub tree see below: File locations /application/controller/* /application/models/* /application/views/* /application/views/layouts /application/views/layouts/basic /application/views/layouts/basic/basic.phtml // basic layout template Base file content: headTitle() ?> headLink() ?> headScript() ?> headStyle() ?> // not displaying render('header.phtml') ?> placeholder('nav') ?> layout()->content ?> render('footer.phtml') ?> /public_html/images/logo.gif /public_html/css/lib.css /public_html/index.php // bootloader Any thoughts would be great, I'm sure I'm missing something simple. -- Matthew Weier O'Phinney PHP Developer| [EMAIL PROTECTED] Zend - The PHP Company | http://www.zend.com/
Re: [fw-general] Zend_Layout - images and css not loading
-- Peter Atkins <[EMAIL PROTECTED]> wrote (on Friday, 01 February 2008, 11:34 AM -0800): > This is my first post to the list, and also my first project with ZF. > > I'm trying to implement Zend_Layout with all the MVC elements outside of > the public doc root. This also includes the new layout templates (I also > tried with templates in pub tree). > > This issue I'm having is that the "css" and/or "images" are not displaying. > I have an image call in the base.phtml template and I'm trying to load the > css from the indexController using ... > > $this->view->headLink()->appendStylesheet('/css/lib.css'); > > It produces the proper code: rel="stylesheet" type="text/css" /> Wait -- where did the leading '/' go? That could very well be the issue, as without the leading slash, the browser is going to look in the path, which could likely contain a /controller/action/ string... leading to a 404 for the file. appendStylesheet() shouldn't be trimming this off, nor should headLink() be removing it when rendering itself. You're sure you're adding it with the leading slash? > They are located in the pub tree see below: > > File locations > /application/controller/* > /application/models/* > /application/views/* > /application/views/layouts > /application/views/layouts/basic > /application/views/layouts/basic/basic.phtml // basic layout template > > Base file content: > > > > headTitle() ?> > headLink() ?> > headScript() ?> > headStyle() ?> > > > > // not displaying > > > render('header.phtml') ?> > placeholder('nav') ?> > layout()->content ?> > render('footer.phtml') ?> > > > > /public_html/images/logo.gif > /public_html/css/lib.css > /public_html/index.php // bootloader > > > Any thoughts would be great, I'm sure I'm missing something simple. -- Matthew Weier O'Phinney PHP Developer| [EMAIL PROTECTED] Zend - The PHP Company | http://www.zend.com/