Welcome Guest, Not a member yet? Register   Sign In
How to use a variable in: $this->index(); ?
#2

[eluser]eoinmcg[/eluser]
you should read up on OOP in php.
Code:
$this->page
refers to a property of the object (i.e. variable)
Code:
$this->page
refers to a method (i.e. function)

Code:
<?php

class Name extends Controller
{

    public $page = 'index';

    public function __construct()
    {
        parent::__construct();
    }


    public function index()
    {
    }

    public function test()
    {
        echo $this->page;
        $this->page = 'whatever';
        echo $this->page;

    }

}


Messages In This Thread
How to use a variable in: $this->index(); ? - by El Forum - 04-15-2010, 02:09 AM
How to use a variable in: $this->index(); ? - by El Forum - 04-15-2010, 02:23 AM
How to use a variable in: $this->index(); ? - by El Forum - 04-15-2010, 02:29 AM
How to use a variable in: $this->index(); ? - by El Forum - 04-15-2010, 02:35 AM
How to use a variable in: $this->index(); ? - by El Forum - 04-15-2010, 02:43 AM
How to use a variable in: $this->index(); ? - by El Forum - 04-15-2010, 03:03 AM
How to use a variable in: $this->index(); ? - by El Forum - 04-15-2010, 03:42 AM



Theme © iAndrew 2016 - Forum software by © MyBB