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.

Archive /

Our old forums are still available as a read-only archive.

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

Using sapphire with my PHP scripts


Go to End


2 Posts   1390 Views

Avatar
Rhapsodus

Community Member, 1 Post

25 June 2008 at 9:25pm

Ok I have sapphire installed, cms runs great, site is using templates just fine...

I have custom scripts though so my site's tree looks like.

/root/
/root/mystuff/myscript.php
/root/sapphire/etc....

The question I have is this... Everything in myscript.php is easy and works by itself... It creates a few variables does some number crunching and spits output. The problem I have is that I am not sure how to include the sapphire codebase in myscript.php such that I can get access to its classes / functions..

Namely I want to call Member::currentUser()...

Ideas?

Avatar
Willr

Forum Moderator, 5523 Posts

26 June 2008 at 1:46pm

You could run sapphire like that. Eg your PHP not in the mysite folder but the autoloader will be a bit screwed so you would have to include the sapphire files in order in your code - similar to sapphire/main.php.

Why do you need external PHP files rather then building a sapphire project - with the code in the mysite/code folder?