[php]class index {
var $class;
var $title = “Test”;
var $nav = “home”;
var $output = “”;
[/php]
My coding {$this->class->base_url} is not working in the class… how can I fix this? mind is off tonight…
[php]class index {
var $class;
var $title = “Test”;
var $nav = “home”;
var $output = “”;
[/php]
My coding {$this->class->base_url} is not working in the class… how can I fix this? mind is off tonight…
[php]
class index {
var $class;
var $title = “Test”;
var $nav = “home”;
var $output = “”;
[/php]
Sorry forum coding doesn’t turn it red… adds a red coding i didn’t have this is the correct format of the coding
[php]class index {
var $class;
var $title = “Test”;
var $nav = “home”;
var $output = “”;[/php]
grr where is the edit button…
Use the construct
[php]
class index {
var $class;
var $title = “Test”;
var $nav = “”;
var $output = “”;
public function __construct() {
$this->nav = "<a class='navlink' href='{$this->class->base_url}do=idx&page=home'>home</a>";
}
}
[/php]
Thanks for the Post!
Tried that and the only put of the coding not working is {$this->class->base_url} Its not giving the base URL to the Link…
Alls Im trying to do is create a NAV tag without having to put index.php?.. could it be something esle?
[php]$output = str_replace("<% NAV %>",$b[‘nav’],$output );[/php]
What are you setting as $this->class?
[php]function init()
{
require_once(ROOT.‘config.inc.php’);
require_once(KERNEL.‘session.php’);
$this->session = new session();
$this->session->class =& $this;
require_once(KERNEL.‘library.php’);
$this->lib = new library($this);
//$this->lib->class =& $this;
$this->parse_input();
$this->connect($db);
$this->var = $var;
$this->base_url = $this->var[‘site_url’].‘index.php?’;[/php]
this is what I have it set to.
That looks really strange. Is that init() function also in a class? I think you are misusing the classes here.
[php]class Class {
var $input = array();
var $DB = array();
var $offset = -18000;
var $template = array();
var $member = array();
var $var = array();
var $session;
function init()
{
require_once(ROOT.'config.inc.php');
require_once(KERNEL.'class_session.php');
$this->session = new session();
$this->session->class =& $this;
require_once(KERNEL.'class_library.php');
$this->lib = new library($this);
//$this->lib->class =& $this;
$this->parse_input();
$this->connect($db);
$this->var = $var;
$this->base_url = $this->var['site_url'].'index.php?';
$this->image_url = $this->var['site_url'].'images/';
$this->icon_url = $this->var['site_url'].'templates/icons/';
require_once(KERNEL.'class_display.php');
$this->display = new display();
$this->display->class =& $this;
}[/php]
This is my full coding to this file and I have been using this format for a couple years with no issue…
m@tt thank u for the help, your solution was correct. I Mistyped it. I just got it working like how I wanted.
Thank u Again!