0
votes

I am new to ZF but have been looking into one specific issue I am having. I am currently trying to append a stylesheet to my site through the layout.phtml file. It works fine when the URL remains at the index action of a controller however if I go to site/controller/method the stylesheet presents incorrectly. I am doing everything right I believe. I have used the following code on my site to append the stylesheet:

<?php
        $this->headLink()->appendStylesheet($this->baseUrl('stylesheets/style.css'))
                ->appendStylesheet($this->baseUrl('stylesheets/jplayer.css'))
                ->appendStylesheet($this->baseUrl('stylesheets/contact.css'));
        echo $this->headLink();
        $this->headScript()->appendFile("http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js");
        echo $this->headScript();
        ?> 

I have also tried doing this from the controller action minus the echo part which ends up breaking the page all together.

EDIT: I got the css to show up now but the font wont display the correct one. Has anyone experienced this and could this be a part of my css directing to the incorrect path or the font breaking somewhere.

1

1 Answers

0
votes

Keep stylesheets folder in public direcory of your project

 <?php

    $this->headLink()->appendStylesheet('stylesheets/style.css');
    $this->headLink()->appendStylesheet('stylesheets/jplayer.css');
    $this->headLink()->appendStylesheet('stylesheets/contact.css');
    echo $this->headLink();
    $this->headScript()->appendFile("http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js");
    echo $this->headScript();

 ?> 

Hopes it will solves your problem