$sf_response->addStyleSheet() dosen't work in SF 1.4?

前端 未结 3 682
时光取名叫无心
时光取名叫无心 2021-01-23 12:03

Does anyone know how to add stylesheets in a template with Symfony 1.4 ?

I have tried everything I can think of, from modifying frontend/config/view.yml to modifying the

3条回答
  •  生来不讨喜
    2021-01-23 12:13

    Edit:

    Ok I think I got it now. You should add include_stylesheets() into the head section of your layout file:

    
       
           This is the title
           
       
       
       
    

    Then in your template file, you use use_stylesheet() to add a particular stylesheet for this template:

    
    

    From the API documentation:

    include_stylesheets()
    Prints tags for all stylesheets configured in view.yml or added to the response object.

    use_stylesheet()
    Adds a stylesheet to the response object.

    Same for Javascript.


    According to the API documentation it should still work in 1.4, sfWebResponse still has this method:

    addStylesheet ($file, $position, $options)   
      $file   The stylesheet file  
      $position   Position   
      $options    Stylesheet options  
    Adds a stylesheet to the current web response.
    

    At least the method exists.
    What exactly is the problem? Do you get an error if you want to call that method or is the stylesheet just not added?

提交回复
热议问题