I've been at this for hours, over and over. This code is meant to be a smarty template.
I know my constructor isn't getting the member variable, but why???? I have been over it so many times and I still can't see anything. Are my eyes deceiving me?
Here is the error I'm getting:
Fatal error: Call to a member function GetLinks() on a non-object in /home/david/www/doug/acurrent/smarty_plugins/function.load_links_list.php on line 38 here are the 3 pages of code:
--------Page do_link.php----------
<?php
// data tier class
class DoLink
{
// class constructor
function __construct()
{
// get the global DbManager instance (created in app_top.php)
$this->dbManager = $GLOBALS['gDbManager'];
}
//retrieves all pages
public function GetLinks()
{
$query_string = "SELECT page_id, name from content";
$result = $this->dbManager->DbGetAll($query_string);
return $result;
}
}//end dolink
?>
--------end do_link.php----------
------ page bo_link.php----------
<?php
// reference the data tier
require_once SITE_ROOT .'/data_objects/do_link.php';
// Class that stores the results of a product catalog search
// business tier class for reading products catalog information
class BoLink
{
/* private stuff */
private $mDoLink;
// class constructor initializes the data tier object
function __construct()
{
$this->mDoLink = new DoLink();
}
//retrieves all pages for the site
public function GetLinks()
{
$result = $this->mDoLink->GetLinks();
return $result;
}
} //end bolink
?>
-----------end bo_link.php----------------
----------page function.load_links_list.php----------------
<?php
// plugin functions inside plugins files must be named: smarty_type_name
function smarty_function_load_links_list($params, $smarty)
{
$links_list = new LinksList();
$links_list->init();
// assign template
$smarty->assign($params['assign'], $links_list);
}
//manage the pages list
class LinksList
{
/* public variables available in pages_list.tpl Smarty template */
public $mLinks;
public $mSelectedLink;
/*private members*/
private $mBoLink;
//constructor initializes the business tier object (bo_catalog) and reads query string parameter
function _construct()
{
//create the middle tier object
$this->mBoLink = new BoLink();
//if pageID exists in the query string, we're on that page
if(isset($_GET['LinkID']))
$this->mSelectedLink = (int)$_GET['LinkID'];
else $this->mSelectedLink = -1;
}
//calls the business tier (bo_objects) method to read the pages list and create the links
function init()
{
//get the list of pages from the business tier (bo_objects)
$this->mLinks = $this->mBoLink->GetLinks();
//create the page links
for($i = 0; $i < count($this->mLinks); $i++)
$this->mLinks[$i]['onclick'] = "index.php?PageID=" . $this->mLinks[$i]['page_id'];
}
} //end class
?>
----------------end function.load_links_list.php-------------