priktop
priktop

Reputation: 1155

Zend Framework problem with adding CSS files

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.

Upvotes: 0

Views: 1964

Answers (2)

Stephen
Stephen

Reputation: 91

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.

Upvotes: 0

easwee
easwee

Reputation: 15895

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

Upvotes: 2

Related Questions