Jump to content

[SOLVED] I always get this error, I cant find the problem


chmpdog

Recommended Posts

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  :)

 

 

 

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';

}

?>

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.