Asset_Helper For Newbie to setting up external CSS |
[eluser]Unknown[/eluser]
Hello guys, 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: 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: Code: <?php so it becomes (codeigniter\system\application\views\hello_view.php), the code are: [code] <html> <head><title>Title</title> </head> <body> <h1> This is Body Title with External CSS placed in assets</h1> <p><?php echo "Hello, this is made with php ",$message ?> </p> </body> </html> /code] 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, maybe my question is so basic... i hope many newbies can be helped through this question too.
[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() View Code: <html> |
Welcome Guest, Not a member yet? Register Sign In |