Welcome Guest, Not a member yet? Register   Sign In
Fatal error: Using $this when not in object context
#8

[eluser]flumps[/eluser]
[quote author="Rick Jolly" date="1187063380"]We're here to help.

Since the header view is being loaded from a view, the easiest thing to do would be to create a global variable $base_view. To create global variables that are available to all your views, use $this->load->vars() like so:
Code:
class Pages extends Controller {

  function Pages()
  {
    parent::Controller();
    $data['base_view'] = $this->config->view('base_view');
    $this->load->vars($data);
  }

  ...
}
Then in the header.php view you could write it like coolfactor suggested:
Code:
<link href="<?=$base_view;?>style.css" rel="stylesheet" type="text/css">
[/quote]

thanks very much Smile very helpfull.

will give that a bash tomorrow as time is getting on and ive got to be up at 6am :-s.


Messages In This Thread
Fatal error: Using $this when not in object context - by El Forum - 08-12-2007, 03:38 PM
Fatal error: Using $this when not in object context - by El Forum - 08-12-2007, 04:15 PM
Fatal error: Using $this when not in object context - by El Forum - 08-13-2007, 04:04 AM
Fatal error: Using $this when not in object context - by El Forum - 08-13-2007, 10:04 AM
Fatal error: Using $this when not in object context - by El Forum - 08-13-2007, 04:15 PM
Fatal error: Using $this when not in object context - by El Forum - 08-13-2007, 04:49 PM
Fatal error: Using $this when not in object context - by El Forum - 08-13-2007, 04:51 PM
Fatal error: Using $this when not in object context - by El Forum - 08-13-2007, 04:52 PM
Fatal error: Using $this when not in object context - by El Forum - 08-14-2007, 01:39 AM
Fatal error: Using $this when not in object context - by El Forum - 08-14-2007, 03:45 AM
Fatal error: Using $this when not in object context - by El Forum - 08-14-2007, 09:36 AM
Fatal error: Using $this when not in object context - by El Forum - 08-14-2007, 02:01 PM
Fatal error: Using $this when not in object context - by El Forum - 08-14-2007, 02:04 PM
Fatal error: Using $this when not in object context - by El Forum - 08-14-2007, 02:08 PM
Fatal error: Using $this when not in object context - by El Forum - 08-14-2007, 02:22 PM
Fatal error: Using $this when not in object context - by El Forum - 08-14-2007, 03:20 PM
Fatal error: Using $this when not in object context - by El Forum - 08-15-2007, 03:30 PM
Fatal error: Using $this when not in object context - by El Forum - 08-15-2007, 04:12 PM
Fatal error: Using $this when not in object context - by El Forum - 08-16-2007, 02:30 AM
Fatal error: Using $this when not in object context - by El Forum - 08-26-2007, 05:26 PM



Theme © iAndrew 2016 - Forum software by © MyBB