Jump to content

Bootstrapping outside PHP app directories


Christian
 Share

Recommended Posts

No, not by an URL. That'd be a huge security issue, among other problems, since by bootstrapping ProcessWire your script essentially gains superuser permissions..  :)

Bootstrapping generally requires the sites to be on same server, so as long as that's true this isn't a problem. If they're hosted on different environments, you'll have to mock up a public API of sorts to share data, provide views that are embedded via iframes.. or use Pages Web Service to connect the sites.

Link to comment
Share on other sites

Theoretically there is another option from a different server thinking about it:

  1. Install PW on both servers.
  2. Change the config file on the second server to access the first server's PW database

This should let you access the majority of field data at least, but you will need to think about things a bit more carefully if you need to display images etc.

Link to comment
Share on other sites

Hi all! I'm currently on a team w/ Christian, the scenario is we have a separate website that uses Phalcon (1st team) that administers the RESTful dynamic API requests by a 3rd party 'front-end' site (2nd team). We as the 3rd team decided to use PW for managing the static contents of the 'front-end' site hence we are hosted on another separate domain.

Currently, we'd be implementing the 'auto-login' so there'll be only a 'CMS' button from the 'Phalcon' team admin page that redirects to our 'CMS' team and have the administrator manage the content from there. BTW, it'll be also the 'Phalcon' team's API that will request the JSON data that they require from our CMS and we have used the module 'ServicePages' to serve the content, from there they'll then pass the 'contents' they got from us, add their own stuff and feed it into the 'front-end' teams pages.

I was thinking of using the Phalcon PHP w/ Processwire CMS' admin pages 'embedded' inside Phalcon using as Pete has suggested. I am able to access some templates and such but was like thinking of be able to call the 'Pages', 'Setup', 'Modules' themselves inside Phalcon via Processwire API. Is it feasible?

Thank you all in advance for your insights!

Link to comment
Share on other sites

I would may create a custom API template inside pw.

Just create a page called "api" using a template "api". In the api.php template file just get all the data phalcon needs put it in an array and use json_encode before "echoing" it. You could add a access restriction with something like "yoursite.com/api/?pass=loremipsum" and a check at the beginning. 

This way you can offer palcon all the data it needs but don't grant directly access. This way processwire stays save and you don't have to tap the database.

Link to comment
Share on other sites

I was thinking of using the Phalcon PHP w/ Processwire CMS' admin pages 'embedded' inside Phalcon using as Pete has suggested. I am able to access some templates and such but was like thinking of be able to call the 'Pages', 'Setup', 'Modules' themselves inside Phalcon via Processwire API. Is it feasible?

Just checking: are you trying to embed actual Admin UI (the admin tool you use to manage PW content with a browser) within Phalcon's admin pages? That's the idea I'm getting from your post and if that's the case, it has very little to do with API and bootstrapping.

By bootstrapping you gain access to ProcessWire's content via API, i.e. you can use wire('pages')->find('...') etc. in external code. Admin, on the other hand, is best described as an application built on top of ProcessWire's core (and thus it itself uses the API that ProcessWire provides).

If you want to embed the entire admin tool into another application, you've got several options:

  • embed entire admin tool with an iframe (not exactly a pretty method, even though individual pages in ProcessWire's admin can actually be embedded as "modal" views by using GET param 'modal', e.g. example.com/processwire/page/?modal=1)
  • redirect users to said URL directly (if I'm reading you correctly, this is what you're doing right now)
  • create a custom admin page to the ProcessWire site for managing content and embed that (most likely still using an iframe)
  • create a custom application within Phalcon's admin page that bootstraps ProcessWire and uses it's API to manage content (this would probably be the cleanest solution, but I've no idea how Phalcon really works so can't really provide any additional pointers)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...