I have a CakePHP model in which several functions work well. Now I'm trying to write a new function that uses several functions that I already wrote. It sounds like it should be easy, but I can't understand the syntax. How can I name these functions that I already wrote in my new?
Example:
<?php public function getHostFromURL($url) { return parse_url( $http.$url, PHP_URL_HOST ); } public function getInfoFromURL($url) { $host = getHostFromURL($url); return $host; }
Result:
Fatal error: call to undefined function getHostFromURL () in /var/www/cake/app/Model/Mark.php on line 151
I also tried something like:
<?php public function getHostFromURL($url) { return parse_url( $http.$url, PHP_URL_HOST ); } public function getInfoFromURL($url) { $host = this->Mark->getHostFromURL($url); return $host; }
But got the same result.
Obviously my functions are much more complicated than that (otherwise I would just use them again), but this is a good example.
Nick source share