Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

how to include own php class ?


Go to End


10 Posts   8099 Views

Avatar
snaip

Community Member, 181 Posts

29 September 2010 at 1:08am

still have this problem

Kontakt.php


class Kontakt extends Strona {
}

class Kontakt_Controller extends Strona_Controller {

    function contact() {
        include 'Form.php';
        $form = new Form();

        return $form->a();
    }

}

code/Form.php


<?php

class Form {

    public function a() { 
        echo 'something';
    }

}

?>

Kontakt.ss

$contact

no errors, site is blank
what is wrong ?

Avatar
Willr

Forum Moderator, 5523 Posts

29 September 2010 at 5:03pm

snaip this is probably due to the fact SilverStripe has a built in Form class, you cannot redeclare a class with the same name.

You're getting a white screen probably due to display_errors being turned off in your php.ini file. If you turn that to on, restart apache you should hopefully start to get useful error messages.

Go to Top