0

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.

4

1 回答 1

0

将样式表文件夹保存在项目的公共目录中

 <?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();

 ?> 

希望它能解决你的问题

于 2012-08-14T11:48:26.457 回答