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

 

 

 

Link to comment
Share on other sites

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

}

?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.