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.... > > > > <html> > > <head> > > <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> > > <title>Home</title> > > <link href="/css/lib.css" media="screen" rel="stylesheet" > > type="text/css" /> </head> > > <body> > > <img src="images/order.gif"> > > <div id="header"><!-- base/header --> > > <br><br></div> > > ..... > > > > 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: <link href="css/lib.css" media="screen" > >>> 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: > >>> <html> > >>> <head> > >>> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> > >>> <?= $this->headTitle() ?> > >>> <?= $this->headLink() ?> > >>> <?//= $this->headScript() ?> > >>> <?//= $this->headStyle() ?> > >>> </head> > >>> <body> > >>> > >>> // not displaying > >>> <img src="/images/logo.gif"> > >>> > >>> <div id="header"><?= $this->render('header.phtml') ?></div> > >>> <div id="nav"><?= $this->placeholder('nav') ?></div> > >>> <div id="content"><?= $this->layout()->content ?></div> > >>> <div id="content"><?= $this->render('footer.phtml') ?></div> > >>> </body> > >>> </html> > >>> > >>> /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/ >
