chmpdog Posted September 8, 2007 Share Posted September 8, 2007 Hi, I have been trying to make my site and I am getting this error: Parse error: parse error, unexpected $ in /home/content/includes/main.php on line 58 line 58 is the closing ?> tag Here is my code : <?php function load_content() { if(!isset($_GET['page'])){ } else { if ($_GET[task] == 'login') { include ('login.php'); } else if ($_GET[task] == 'mostplayed') { include ('mostplayed.php'); } else { if(!$_GET[task]) { // HOMEPAGE echo 'homepage'; } function title() { include ('config.php'); if($_GET[task] == 'login') { echo 'Login';} else if($_GET[task] == 'register') { echo 'Register';} } function navi() { include 'includes/nav.html'; } function header() { include 'includes/header.html'; } function footer() { include 'includes/footer.html'; } function css() { include 'include/cssjava.html'; } ?> And this file is included in the index: <? include ('includes/main.php'); ob_start(); // Include the template include ('template/index.php'); ob_end_flush(); ?> Thanks for the help I appreciate it Quote Link to comment https://forums.phpfreaks.com/topic/68478-solved-i-always-get-this-error-i-cant-find-the-problem/ Share on other sites More sharing options...
BlueSkyIS Posted September 8, 2007 Share Posted September 8, 2007 looks like function title() is not closed. Quote Link to comment https://forums.phpfreaks.com/topic/68478-solved-i-always-get-this-error-i-cant-find-the-problem/#findComment-344251 Share on other sites More sharing options...
wildteen88 Posted September 8, 2007 Share Posted September 8, 2007 You had a load of curly braces missing in your code for the load_content function. Also I noticed you had defined a function called header. You cannot redefine a function already used by PHP. I renamed your header function to page_header instead. <?php function load_content() { if (isset($_GET['task'])) { switch($_GET['task']) { case 'login': include 'login.php'; break; case 'mostplayed': include 'mostplayed.php'; break; default: echo 'homepage'; break; } } else { // HOMEPAGE echo 'homepage'; } } function title() { include 'config.php'; if(isset($_GET['task']) && $_GET['task'] == 'login') { echo 'Login'; } elseif(isset($_GET['task']) && $_GET['task'] == 'register') { echo 'Register'; } } function navi() { include 'includes/nav.html'; } function page_header() { include 'includes/header.html'; } function page_footer() { include 'includes/footer.html'; } function css() { include 'include/cssjava.html'; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/68478-solved-i-always-get-this-error-i-cant-find-the-problem/#findComment-344253 Share on other sites More sharing options...
chmpdog Posted September 8, 2007 Author Share Posted September 8, 2007 Thanks, I guess this is why i am a noob Quote Link to comment https://forums.phpfreaks.com/topic/68478-solved-i-always-get-this-error-i-cant-find-the-problem/#findComment-344263 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.