j05hr Posted May 13, 2010 Share Posted May 13, 2010 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 More sharing options...
KevinM1 Posted May 13, 2010 Share Posted May 13, 2010 The error means what it states - you don't have a function named get_pages_for_subject() defined in a place where public_navigation() can 'see' it. This either means it exists somewhere, and needs to be included, or it doesn't exist, and it's up to you to create it. Link to comment https://forums.phpfreaks.com/topic/201668-undefined-function-problem/#findComment-1057902 Share on other sites More sharing options...
Mchl Posted May 13, 2010 Share Posted May 13, 2010 Search your source code for definition of get_pages_for_subject() function, and make sure the file it's in, is included into your script. Link to comment https://forums.phpfreaks.com/topic/201668-undefined-function-problem/#findComment-1057903 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.