Jump to content

Fatal error: Cannot access self:: when no class scope is active


dav3

Recommended Posts

Hey guys i tried searching for a topic like this but i couldn't find anything that really helped me solve my own issue.  I am a php noob and got help designing the pages of my site that needed php coding.  This specific issue is with a admin panel where i can swap banners on my site when my product sells and replaces it with a new picture.

 

www.haloprogaming.com/ ----> lvl 50s

 

As you can see it is set with default banners that i should be able to exchange but i get the error described in the title.  I looked at the coding and here are lines 88 - 100 which is including the line 94 where the error occurs.

 

        /*    Scan the dir and recursively unlink    */
        $files = scandir($path);
        foreach($files as $filename)
        {
            if($filename == '.' || $filename == '..') continue;
            $file = str_replace('//','/',$path.'/'.$filename);
94>>>    self::unlink($file);       <<<<94
        }//end foreach
       
        /*    Remove the parent dir    */
        if(!@rmdir($path)) return false;
        return true;
    }

 

Thanks so much for the help.

-Dave

 

P.S. Exact error code:

Fatal error: Cannot access self:: when no class scope is active in /home/halosinf/public_html/haloprogaming.com/cp1/editlogoprocess.php on line 94

Link to comment
Share on other sites

It is not to delete an item.  He set the admin panel up so that when i have a banner on my site i can create a new banner with the same attributes and exchange it by using this admin panel.  When switch them though that is the error i get.

-Dave

Link to comment
Share on other sites

It is not to delete an item.  He set the admin panel up so that when i have a banner on my site i can create a new banner with the same attributes and exchange it by using this admin panel.  When switch them though that is the error i get.

-Dave

What in the world did you just say?

Link to comment
Share on other sites

It is not to delete an item.  He set the admin panel up so that when i have a banner on my site i can create a new banner with the same attributes and exchange it by using this admin panel.  When switch them though that is the error i get.

-Dave

Is this what you are saying?

Someone has build the backend (admin panel as you name it) for you. One of the features of your backend is to change a banner. This banner is visible on frontend of your website(the website visible to the users that visit the site).

 

My question to you is

Can you change the image inside that banner and does it make you upload a new one?

Link to comment
Share on other sites

Ok so i found out that in line 94 it just as the tag "self" but it needs to be assigned in a class.  Here is what my server provider has said.

 

"It seems it's more coding issue than PHP configuration issue. It might work with some PHP versions but it doesn't work with PHP 5.2.9 as far as I can see. I tried enabling PHP4 version and it reproduced another error.

 

Most probably that the call should be inside a class declaration, instead of free within the php tags.

Thank You

Sergey"

 

I guess i need to assign a class with it but i have no idea how to do it.  If anyone knows what is going on please any help would be appreciated.  If there is any physical work you have to do to the coding i can pay you for your time just let me know.

 

Thanks.

-Dave

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.