Several of the functions were simple things that did not require parameters and did not return them. For instance the following function to place at the top of each page
Code: Select all
function main_page_header($page_title) {
echo '<!DOCTYPE HTML>';
echo '<html>';
echo '<head>';
echo '<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">';
echo '<title>' .$page_title. '</title>';
echo '<link href="css/main.css" rel="stylesheet" type="text/css" />';
echo '</head>';
echo '<body>';
}I would just include the main_fns.php include on each page, then call this function with like main_page_header("Welcome to the Main Site"); type of statement.
I now want to replace this main_fns.php with a Class that includes various public functions. My biggest problem, though, is how exactly to invoke that same method in my code. Here's a portion of what I have:
Code: Select all
<?php
require_once ('MySQL.php');
Class FileInfo {
public function pageStart($page_title) {
echo '<!DOCTYPE HTML>';
echo '<html>';
echo '<head>';
echo '<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">';
echo '<title>' .$page_title. '</title>';
echo '<link href="css/main.css" rel="stylesheet" type="text/css" />';
echo '</head>';
echo '<body>';
}
public function pageEnd() {
echo '</body>';
echo '</html>';
}
However when I go to use the function with $fi->pageStart("Welcome to the Main Site"); nothing happens. In fact, the program acts as if it has errors but none are reported.
Can someone point me in the right direction on how to make this work?
Thanks!