• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Class Doesn't like $page variable

#1
[eluser]Unknown[/eluser]
I get an error at the page variable. I have no idea what's going on.

Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Header_Model extends CI_Model{

public $page   = substr(end(explode(DIRECTORY_SEPARATOR, $_SERVER['PHP_SELF'])), 0, -4);
public $nav_names = array('Contact', 'About', 'Tools', 'Portfolio', 'Writing');

function get_page_name()
{
  $this->load->library('common');
  
  $page_names = $this->common->page_names();

  $title = (array_key_exists($this->$page, $page_names) !== false) ? $page_names[$this->$page]: '';

  if (array_key_exists($this->$page, $page_names) !== false)
  {
   $title .= " | Jason";
  }
  
  return $title;
}

function get_gutter_value()
{
  $gutter_values  = array('307', '230', '161', '84', '0');
  
  foreach($nav_names as $k => $name)
  {
   if($this->$page === strtolower($name))
   {
    $g_value = $gutter_values[$k];
   }
   else
   {
    $g_value = 0;
   }
  }
  
  return $g_value;
}

function get_js_page_file()
{
  if (file_exists("./assets/js/pages/${this->$page}.js"))
  {
   $javascript = "[removed]$page}.js\">[removed]";
  }
  
  return $javascript;
}
}


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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