Jump to content

undefined function problem


j05hr

Recommended Posts

I'm following a tutorial making a custom CMS.  they were using subjects and pages and I decided just to use subjects as I didn't have seperate pages to the subject.

 

The error message I am getting is,

 

Fatal error: Call to undefined function get_pages_for_subject() in C:\wamp\www\cms\includes\functions.php on line 99

 

This is the code

 

function public_navigation($sel_subject, $sel_page, $public = true) {
	$output = "<ul class=\"subjects\">";
	$subject_set = get_all_subjects($public);
	while ($subject = mysql_fetch_array($subject_set)) {
		$output .= "<li";
		if ($subject["id"] == $sel_subject['id']) { $output .= " class=\"selected\""; }
		$output .= "><a href=\"index.php?subj=" . urlencode($subject["id"]) . 
			"\">{$subject["menu_name"]}</a></li>";
		if ($subject["id"] == $sel_subject['id']) {	
			[b]$page_set = get_pages_for_subject($subject["id"], $public);[/b]
			$output .= "<ul class=\"pages\">";
			while ($page = mysql_fetch_array($page_set)) {
				$output .= "<li";
				if ($page["id"] == $sel_page['id']) { $output .= " class=\"selected\""; }
				$output .= "><a href=\"index.php?page=" . urlencode($page["id"]) .
					"\">{$page["menu_name"]}</a></li>";
			}
			$output .= "</ul>";
		}
	}
	$output .= "</ul>";
	return $output;
}

 

And this is the page it is on

 

<?php require_once("includes/connection.php"); ?>
<?php require_once("includes/functions.php"); ?>

<?php find_selected_page(); ?>
<?php include("includes/header.php"); ?>
<div id="nav">
	<?php echo public_navigation($sel_subject, $sel_page); ?>
	</div>
<div id="banner">
		</div>
		<div id="line">
		</div>
<div id="content"


		<?php if ($sel_subject) { ?>
			<h2><?php echo htmlentities($sel_subject['menu_name']); ?></h2>
			<div class="page-content">
				<?php echo strip_tags(nl2br($sel_subject['content']), "<b><br><p><a>"); ?>
			</div>
		<?php } else { ?>

		<?php } ?>

</div>

<?php include("includes/footer.php"); ?>

 

Thanks Josh

Link to comment
https://forums.phpfreaks.com/topic/201668-undefined-function-problem/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.