Run another controller's method |
[eluser]Phil Sturgeon[/eluser]
[quote author="Sam Dark" date="1203118486"]Sorry for not replying for a while. jbowman is right: I'm trying to implement potal-like View library so it will be able to handle something like this: Code: <html> Calling blog controller's recent action with an array of options and returning output. Why I don't want to implement those recent posts/blog as library? 1. I don't want to write and load library for each of these blocks. 2. I want to use controller's output on it's own page also.[/quote] What you are describing here is the use of a model. This looks like you are just pulling and returning some data basedo na few parameters. That is what a model does. A controller is simply for working out which models, libraries and views to load based on a URL. But if you must be awkward and do it your way, simply use a include() and call the class. Example: Code: <?php I almost feel dirty for showing you that. There is NO case in which you need to do this. If you think you do, you are doing it wrong. Guaranteed.
[eluser]Dam1an[/eluser]
Yeah, this post was resurected by a spammer :grrr: And I don't subscribe to any threads either, but still get them under new posts
[eluser]louis w[/eluser]
Check out the Wick Library Have not had a chance to use it, but looks cool.
[eluser]Unknown[/eluser]
try hmvc! ive ever faced the same problem,and hmvc gave me great solution.you could build modular portal with it
[eluser]metaltapimenye[/eluser]
model. thats to simplify the answer. "put a method in a controller" that was a problem here. just put your method in model part. thats why CI running MVC at the first stone. controller Code: function thread($par1,$par2){ model: Code: function recent_post($top_limit){ Code: <?php $this->load->model('fetcher_model','model');?> |
Welcome Guest, Not a member yet? Register Sign In |