Welcome Guest, Not a member yet? Register   Sign In
to call another action in a view/action
#1

[eluser]ahlofan[/eluser]
do you guys think there would be problems if i do this in a view file

<?php

$c = new SomeController();
$c->index();

?>

It works, but Im wondering is there any other things that I should concern? Will there be any conflicts?

My idea is to create elements in page partially, then to combine them.
#2

[eluser]mTuran[/eluser]
I think it conflicts with MVC pattern. You should try to not use code in your view files.
#3

[eluser]Maglok[/eluser]
Well that is not entirely accurate I'd say. You can use 'code' but you can only use code that is used to display stuff basically. You should initialize new classes in your controller. I am pretty sure it will allow you to do this, but is is not considered 'best practice'. It might also create issues for you in the long run, I am unsure.
#4

[eluser]ahlofan[/eluser]
[quote author="Maglok" date="1245681356"]Well that is not entirely accurate I'd say. You can use 'code' but you can only use code that is used to display stuff basically. You should initialize new classes in your controller. I am pretty sure it will allow you to do this, but is is not considered 'best practice'. It might also create issues for you in the long run, I am unsure.[/quote]

ya, its kind of for displaying only. Basically, my idea is just like playing puzzles, putting some components together in a page, but each components are written separately in different set of MVC.
#5

[eluser]TheFuzzy0ne[/eluser]
HMVC may be better suited to your needs. http://codeigniter.com/wiki/Modular_Extensions_-_HMVC/
#6

[eluser]ahlofan[/eluser]
[quote author="TheFuzzy0ne" date="1245686214"]HMVC may be better suited to your needs. http://codeigniter.com/wiki/Modular_Extensions_-_HMVC/[/quote]

Thank you very much. Smile this is exactly what i am looking for.




Theme © iAndrew 2016 - Forum software by © MyBB