Welcome Guest, Not a member yet? Register   Sign In
autoload stylesheet
#9

[eluser]Nick Husher[/eluser]
Additionally, the "$this->file()" approach prints the contents of the stylesheet into a <style></style> block, which isn't ideal. If you externally link your stylesheets (with a <link/> tag or otherwise) and your server is set up correctly (with Last-Modified or Expires headers), you can significantly reduce your bandwidth needs for a given page because the stylesheet need only be downloaded once and can be used across pages. My only additional suggestion is to set a base href and declare everything relative to that:
Code:
<html>
<head>
  <base href="<?=site_url() ?>" />
  <link rel="stylesheet" type="text/css" media="all" href="assets/css/style.css" />
...

This way your server's base path could be "www.example.com" while your CodeIgniter base path (defined in config.php) can be something different, such as "www.example.com/my_CI_app/test" while still allowing you to use the same header template in all your views.


Messages In This Thread
autoload stylesheet - by El Forum - 12-01-2007, 11:31 PM
autoload stylesheet - by El Forum - 12-02-2007, 02:04 AM
autoload stylesheet - by El Forum - 12-02-2007, 07:18 AM
autoload stylesheet - by El Forum - 12-02-2007, 11:08 AM
autoload stylesheet - by El Forum - 12-02-2007, 02:17 PM
autoload stylesheet - by El Forum - 12-02-2007, 04:15 PM
autoload stylesheet - by El Forum - 12-02-2007, 04:38 PM
autoload stylesheet - by El Forum - 12-28-2007, 04:37 AM
autoload stylesheet - by El Forum - 12-28-2007, 07:40 AM
autoload stylesheet - by El Forum - 12-28-2007, 09:36 AM
autoload stylesheet - by El Forum - 07-10-2008, 09:58 AM



Theme © iAndrew 2016 - Forum software by © MyBB