Forum Moderators: coopster

Message Too Old, No Replies

calling a function from a function in the same class

$this might be the problem here......maybe?

         

cyberjunky

3:18 am on Aug 17, 2007 (gmt 0)

10+ Year Member



im trying to call another function from inside another function, pretty simple really. Ive worked with PHP for like 2 years but that was a long time ago and ive forgotten loads, so please dont slate me lol...


class Listings
{
function sort_files($list, $link_template)
{
// sort array into url and presentation
foreach($list as $value)
{
// remove directory self and parent
if (($value == "")¦¦($value == ".")¦¦($value == ".."))
{
$new_list = $new_list.($this.make_url($value, $value, $link_template));
}
}
return $new_list;
}

function make_url($url, $link, $template)
{
$template = str_replace("{TAG:URL;}", $url, $template);
$template = str_replace("{TAG:LINK;}", $link, $template);

return $template;
}
}

i have removed everything irrelevant from the class to make it more clear.
The problem lies in the following line:

$new_list = $new_list.($this.make_url($value, $value, $link_template));

maybe its $this but im not sure, i thought $this referred to the same class..the error i get is this:

Fatal error: Call to undefined function: make_url()

obviously i removed the line number and other info as its irrelevant.

Any ideas? any help would be greatly appreciated, im sure its a small problem ;)

WesleyC

3:27 am on Aug 17, 2007 (gmt 0)

10+ Year Member



$this.make_url

Should be:

$this->make_url

You're using C# syntax there. ;)

cyberjunky

3:33 am on Aug 17, 2007 (gmt 0)

10+ Year Member



thanks, just before checking i realised, thats what you get coding and debugging at 4:30 in the morning....w00t my eyes are red...i should go to sleep now :P

thanks mate ;)