0

This is a best practice type question. I'm dealing with two different frameworks. When I execute a piece of code from one framework on the page of another framework, I'm getting a code conflict. What I'm wondering is how to execute a piece of code on a separate web page and bring in the results AFTER the php on that page has executed and produced its HTML.

One Possible Solution

Use Curl - I could house the additional code on a curl page and bring it in that way, but that seems to have a lot of overhead associated with it.

Is there a lower overhead way of doing this than using curl?

More info

Specifically in this case I'm trying to use a magento php script in my page, and the autoloader is trying to load in other scripts in the directory that should not be auto loaded.

3
  • You probably better want to fix the problem itself. That's what namespacing is for (or are the frameworks large and hard to port to namespaces?) Commented Jan 18, 2011 at 14:48
  • Does the second piece of code need access to the $_SESSION, $_REQUEST vars and the like? If not, you could always invoke it with an exec and skip the web server call... Commented Jan 18, 2011 at 14:56
  • @Damp, I can try and see, but I think it needs access to web variable. Commented Jan 18, 2011 at 15:22

1 Answer 1

1

Resolve the 'conflict' by wrapping the library code in an class where you define the interface. Then call that class directly.

Adding a server side request to another resource will extend the time each request takes (remember the second request has to fire up a database connection, load the framework, carry out a db query etc).

Sign up to request clarification or add additional context in comments.

1 Comment

I could stick it in a class, but I'm not sure about how defining the interface and how that isolates it from the php that's executing on the page. Can you shed some light on that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.