Jump to content


Question :Zend Framework CSS layout

  • Please log in to reply
1 reply to this topic

#1 JohnD


    New member

  • New Members
  • 4 posts

Posted 28 April 2011 - 01:00 AM

Hi ,
I'm new to the Zend Framework , sorry for my dump question .
I have created a project with the zf tool , my layout is archived with layout.php and CSS .
Only the index.php ( index/index.php , someothercontroller/index.php etc... ) are working with the CSS .
All other view's (index/otherview.php , someothercontroller/otherview.php ) are rendered without CSS . It seems that the path of the CSS file can't be found .
My CSS file is in the APPLICATION_DIR/public/style.css directory .
My lyaout.php file is configured as follows :
< ?php echo $this->headLink()->appendStylesheet('style.css') ?>

The source code on my browser shows :
<html >
<title>Your Title</title>

<link href="style.css" media="screen" rel="stylesheet" type="text/css" />

My browser's CSS source code shows the same CSS path on all pages (pages that are rendered correctly and pages that don't )
I can provide more details if my question is not understandable .
  • 0

#2 JohnD


    New member

  • New Members
  • 4 posts

Posted 28 April 2011 - 05:04 AM

Hi again ,
Finally , it was the definition of the path on my layout file :
<?php echo $this->headLink()->appendStylesheet('http://zendtest.loca...a/css/style.css'); ?>

Using an absolute path solved my problem ,it works .
But now ,when observing the source code of my browser when loading the page I mention that the "style link" is mentioned twice ;
<link href="style.css" media="screen" rel="stylesheet" type="text/css" />
<link href="http://zendtest.loca.../css/style.css" media="screen" rel="stylesheet" type="text/css" />

I can't explain that , although my application works on my local development environment ;

< ?php
/* Comments : Thanks to this forum :) */

  • 0

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

★★★★★ 5 Star Rated Web Developer Course - check it out now!