0

I have a small problem when loading CSS files with the Zend Framework. This is my code:

<?php echo $this->headLink()->prependStylesheet($this->baseUrl().'/css/reset.css'); ?> 
<?php echo $this->headLink()->prependStylesheet($this->baseUrl().'/css/main.css'); ?>

When i open the page in my browser, it puts the main before the reset. This way i get my page unstyled because it gets reset by the reset.css.

Any suggestions? Thanks.

1
  • Why not put the reset code into main.css at the begining? You cut down 1 server request and solve the problem with one file. Commented Mar 16, 2011 at 16:12

2 Answers 2

2

Why not put the reset code into main.css at the begining? You cut down 1 server request and solve the problem with one file.

Also you are using prependStylesheet - I never used zend but checking in documentation you also have appendStylesheet - prepend adds it probably before the existing stylesheet in header.

http://framework.zend.com/manual/en/zend.view.helpers.html

Sign up to request clarification or add additional context in comments.

Comments

0

Just to let you know you could shorten your two include statements to one:

<?php echo $this->headLink()->prependStylesheet($this->baseUrl().'/css/reset.css')
                            ->appendStylesheet($this->baseUrl().'/css/main.css'); ?> 

I was looking some similar code in my Zend Framework, and it was actually echoing out the first file (reset.css) twice if you use the appendStylesheet in the second statement in your original code.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.