Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to include css in view file

I have included css in view file as below

<link rel="stylesheet" type="text/css" href="<?php echo $this->baseUrl('style/root.css'); ?>" />
<link rel="stylesheet" type="text/css" href="<?php echo $this->baseUrl('style/reset.css'); ?>" />

But it is giving this error ->

  <b>Message:</b> Invalid controller specified (style)  </p>

in application.ini, I have used this

resources.frontController.baseUrl = "/zendtest/public"
resources.view[] = "";

How do I solve this issue?

like image 966
Navdeep Avatar asked Apr 18 '12 12:04

Navdeep


2 Answers

in any view file (.phtml extension) use something like this for javascript or css:

$this->headScript()->prependFile('/scripts/jquery.min.js');
$this->headScript()->appendFile('/scripts/fg.menu.js');

$this->headLink()->appendStylesheet('/css/form.css');
$this->headLink()->prependStylesheet('/css/jquery_ui_theme/jquery-ui.custom.css');
like image 177
max4ever Avatar answered Oct 04 '22 19:10

max4ever


The code bellow worked for me , ( i suppose you have your css file in 'Public/css/bootstrp.css' ) and paste the line in the head of your View.

<link href="<?php echo $this->baseUrl() . '/css/bootstrap.css'; ?>" media="all" rel="stylesheet" type="text/css" />

like image 37
timmz Avatar answered Oct 04 '22 19:10

timmz