Asset_Helper For Newbie to setting up external CSS

#3
[eluser]Matthieu Fauveau[/eluser]
Hi vinexar,

You are in luck 'cause I'm in an helping mood (while I wait for someone to pick me up, but that's another story).

The asset helper is only returning the HTML string. When you call : css_asset('css/style.css'), it will return the HTML link tag. You need to get that in your $data array to display it into your view.

In a nutshell :

Controller
Code:
function index()
   {        
     $data['css_asset'] = css_asset('css/style.css');
        
     $data['message'] = 'This is for the html body sent from controller';
     $this->load->view('hello_view',$data);
   }

View
Code:
<html>
<head>
  <title>Title</title>
<?php echo (isset($css_asset)) ? $css_asset : '' ?>
</head>

<body>
  <h1>This is Body Title with External CSS placed in assets</h1>  
  &lt;?php echo “Hello, this is made with php “,$message ?&gt;  
&lt;/body&gt;
&lt;/html&gt;


Messages In This Thread
Asset_Helper For Newbie to setting up external CSS - by El Forum - 06-09-2010, 11:03 PM
Asset_Helper For Newbie to setting up external CSS - by El Forum - 06-10-2010, 03:10 AM
Asset_Helper For Newbie to setting up external CSS - by El Forum - 06-12-2010, 01:43 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.