Welcome Guest, Not a member yet? Register   Sign In
How to add some <link rel> for css or js files for specific page when having a template ???
#1

[eluser]bastien31[/eluser]
Hi,

I use CI for some days and it's great !! Smile

But I don't find the solution to a basic problem that some of you have certainly already met.

I have a template (footer, header) for all my pages which. In the head markup of the header file, there is the declaration of all the basic css files and js files which are used all the time im my app.

But for some pages, I need to include other css and js files. How can I do that ??

I don't success to fidn a good way. The only way for the moment is not to use my template for these specific pages and so to copy/paste my footer and header files in the view, so I can modify the head markup.

I used concrete5 CMS which is with the same architecture as CI and I was possible to do it in a view function in the controller, like this:

Code:
public function view() {
  $html = Loader::helper('html');  
  $this->addHeaderItem($html->css('jquery.ui.css'));
  $this->addHeaderItem($html->javascript('jquery.form.js'));
  //$this->addHeaderItem($html->javascript('jquery.ui.js'));  
}

Any idea ?
thanks !
Bastien




Theme © iAndrew 2016 - Forum software by © MyBB