Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Using sapphire with my PHP scripts

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

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

Page: 1
Go to End
Author Topic: 1008 Views
  • Rhapsodus
    Avatar
    Community Member
    1 Post

    Using sapphire with my PHP scripts Link to this post

    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?

  • Willr
    Avatar
    Forum Moderator
    5462 Posts

    Re: Using sapphire with my PHP scripts Link to this post

    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?

    1008 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.