How to use codeigniter helper, model, library etc from a php file |
[eluser]cinewbie81[/eluser]
The following is my code: Code: <?php backendprocess.php Code: <?php I try Code: $obj =& get_instance(); Just for you all information, backendprocess.php.php is located in the same path as /system folder. Hope to hear from you guys soon, thanks
[eluser]xwero[/eluser]
Try to write a custom config variable to a file that way you know the get_instance has passed the CI object.
[eluser]cinewbie81[/eluser]
Hi xwero, I dont quite get what do you mean .. Mind to elobarate ?
[eluser]ejangi[/eluser]
No, I think you need to replicate the index.php file basically - I'm actually working on this same type of thing as we speak - let you know if I have much success.
[eluser]xwero[/eluser]
[quote author="cinewbie81" date="1199967107"] Code: $obj =& get_instance(); instead of this try Code: $obj =& get_instance();
[eluser]ejangi[/eluser]
Okay... So I have worked with Ruby on Rails for a while now and I really miss all my command line goodies - So, last night I decided to try and replicate some stuff in CI. To do that I needed to figure out how to run CI from the command-line. This is very early stages (messy, but working) - I thought I should post it as is so you can get on with your work cinewbie81: Code: #!/usr/bin/php One important thing to note is that I couldn't get it working with the usual relative paths, nor would it connect to the DB if I just had the "hostname" as localhost. I ended up having to change "hostname" to the socket (i.e. :/Applications/MAMP/tmp/mysql/mysql.sock). I imagine this is a standard PHP CLI thing...
[eluser]Grahack[/eluser]
These may help: http://codeigniter.com/wiki/dip_into_CI/comma,d http://codeigniter.com/wiki/Calling_CI_m...de_script/ http://codeigniter.com/wiki/Category:Adv...ronScript/ I'd swear I've already read something about CI through CLI in the wiki but I can't find the article...
[eluser]Peter Ivanov[/eluser]
[quote author="cinewbie81" date="1199967107"]The following is my code: Code: <?php backendprocess.php Code: <?php I try Code: $obj =& get_instance(); Just for you all information, backendprocess.php.php is located in the same path as /system folder. Hope to hear from you guys soon, thanks[/quote] It's pretty simple if you have CURL installed in your ssh console, just expose your backend process somewhere where you can access it via browser and change your index() function to this Code: function index() if you don't have curl you can do this even with wget Code: function index()
[eluser]cinewbie81[/eluser]
Hi all, One question here: What if i want to pass something with a space as the parameter using wget function, something like following: function index() { exec("wget -b http://example.com/mycontroller/myfucntion/param1/this is param 2"); } In mycontroller, i can get param1 using $this->uri->segment(3), but i cant get the full string for next param (this is param 2) because the URL contain a blank space.. any idea ?? |
Welcome Guest, Not a member yet? Register Sign In |