Welcome Guest, Not a member yet? Register   Sign In
Call my website functions from another website...?
#1

[eluser]Frychiko[/eluser]
I have a site coded in CI which is a price comparison shop, but now I need blog functionality and have been thinking about how to proceed next... Right now I've just plugged in Inktype and since it's in CI it's a quick and easy solution but I will need to spend alot of time coding on Inktype since it's very basic at the moment with bugs here and there.

Then I thought, Why not just use wordpress or EE and have my comparison shop on another website and just call the website (somehow?) as widgets in my sidebar. (like top 10 products)

Does this sound like a good idea? If so, how would I go about readying my CI made shop so I can call it from another site?

cheers,
Frychiko
#2

[eluser]SitesByJoe[/eluser]
Should be very easy to pull from your existing site - all your controller methods are public.
#3

[eluser]Colin Williams[/eluser]
You could also make your own models that don't rely on the CI super object (basically just functions that do the SQL queries by hand). These could be used by anything PHP.

Otherwise, create web services that your WP side can call (you could use CIs XML-RPC Class for this).
#4

[eluser]SitesByJoe[/eluser]
What do you mean by make your own models? Can you post a simple example?
#5

[eluser]Frychiko[/eluser]
Alright I think I will go this route! With EE! Thanks for the replies.
#6

[eluser]Colin Williams[/eluser]
Quote:What do you mean by make your own models? Can you post a simple example?

So, when you write a CI model, you are extending the Model class, which gives you access to all that CI has to offer. Imagine writing a model that simply does not rely on extending CI's Model class. This means no CI libs, no CI config, no DB class or ActiveRecord. You give up a lot, but you gain that flexibility.

Here's some pseudo-code:

Code:
class Poll_model {

   function Poll_model()
   {
      // Check for db connection, connect if there is none, or throw an error
   }

   function get_poll($pid)
   {
      return mysql_query('SELECT * FROM '. mysql_real_escape_string('poll')
                        .' WHERE pid='. mysql_real_escape_string($pid));
   }

}




Theme © iAndrew 2016 - Forum software by © MyBB