Skip to main content

Asset_Helper For Newbie to setting up external CSS

June 9, 2010 by vinexar

vinexar's picture

Aloo guys gw ada problem nih, sblmnya gw uda posting di international codeigniter, tapi blm dibales so gw copy-paste aja disini...tolong dibantu...gw gak terjemahin lagi ya :p
thank u nih.

I’m newbie and i cannot find detail step by step guide how set up asset_helper until it works load my css. i used code igniter ver.1.7.2.
I downloaded the asset_helper from:
http://codeigniter.com/wiki/File:asset_helper.zip/

This is the settings of my codeigniter in my personal computer :
1)I build my application at http://localhost/codeigniter/
2)I have set system/application.config/config.php like this
$config[‘base_url’] = “http://localhost/codeigniter”;
$config[‘index_page’] = “”;
3)I have set system/application.config/routes.php like this
$route[‘default_controller’] = “hello”;
4)I have used .htaccess placed in the root where there are placed together with some files and folders like index.php,system,user_guide and license.txt.
my content of .htaccess file is:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|css|js\robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php/$1 [L,QSA]
5)In my CONTROLLER, i make a file hello.php
so it becomes (codeigniter\system\application\controllers\hello.php),
the code are:

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

6)In my VIEWS, i make a file hello_view.php
so it becomes (codeigniter\system\application\views\hello_view.php),
the code are:
--------------------------------------------------------
<-html->
<-head-><-title->Title<-/title->
<-/head->

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

There is no CSS RESULT OF ABOVE CODE when i try in http://localhost/codeigniter/

7)I build a folder asset in the root, together with other files like .htaccess so the structure like:
Folder Structure
assets/
—css/style.css
—image/
—js/

Questions:
1)What must i setting to make my external CSS runs ?
2)what file that the code must i change to? please show me how..

Thank you guys for the help
i hope many newbies can be helped through this question too.

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Okay, tankyou very much for

August 26, 2010 by rmfhp, 1 year 23 weeks ago
Comment: 7064

rmfhp's picture

Okay, tankyou very much for information

Premium Drupal Themes by Adaptivethemes