Newb Warning : question on functions and variables

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
WizyWyg
Forum Commoner
Posts: 92
Joined: Tue Aug 06, 2002 7:20 pm

Newb Warning : question on functions and variables

Post by WizyWyg »

I need to re-write a function, but I can't find anything on basic PHP that explains this (i've never had to use itbefore so I dont know what to call it)

Code: Select all

function load_file($filename, $sName)
     {
         $nName = "";
         $template_path = $this->templates_root . "/" . $filename;
         if (file_exists($template_path))
           {
             $this->DBlocks[$sName] = join('',file($template_path));
             $nName = $this->NextDBlockName($sName);
             while($nName != "")
             {
               $this->SetBlock($sName, $nName);
               $nName = $this->NextDBlockName($sName);
              }
           }
      }
So the code above, what does $this-> mean?
I've seen variables set up as $blah = "value"; but what does the "->" signify?

And links to online resources that explain this would be helpful


feyd|please use

Code: Select all

tags for posting code.[/color]
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

Have a read of http://php.net/oop see if that clears some of it up for you.
WizyWyg
Forum Commoner
Posts: 92
Joined: Tue Aug 06, 2002 7:20 pm

Post by WizyWyg »

Thanks it explains a little. I mtrying to change a function (the above) to pull a template from the DB instead of using STatic HTML pages . Im trying to figure out how to change the functions (there are about 10 of them) to accept the "coding" from the DB but parse it as if it was from the static. html pages. Will probably be back if i run int oproblems.
Post Reply