Welcome Guest, Not a member yet? Register   Sign In
Help ! Where am I supposed to use the smiley and typography helper ?
#1

[eluser]BlueScreenJunky[/eluser]
Hello everyone. First of all I'd like to say that I'm very new to OOP and CodeIgniter, so it's probably a stupid question, so please bear with me ^^

Anyway, I'm creating a simple blog with codeigniter, and so far everything was fine : I have a database with posts and comments, a model to insert/get the posts, one to insert/get comments, a controller, and views to display all that as html.
My controller is able to get the data from the model and pass it directly to the view, and then the view iterates over the various blog posts and comments which is insanely convenient...

Now the thing is, I'd like to use the typography helper, smiley helper, and add a few things of my own before displaying the posts/comments. Where am I supposed to do that ? I have a feeling it's the controller's job, but then it means I have to iterate over all the results in the controller, then rebuild an object or an array myself, and pass it to the view, which is far less convenient.
It would seem much simpler to me to do the formatting directly in the view, while I'm iterating over my posts and comments, but I guess that would make the whole MVC architecture pointless.


Any advice ? Am I even asking the right questions ?

Thanx !
#2

[eluser]BlueScreenJunky[/eluser]
Glad to see the answer to my question is not so obvious after all ;-)
#3

[eluser]astroanu[/eluser]
[quote author="BlueScreenJunky" date="1335426002"]Glad to see the answer to my question is not so obvious after all ;-)[/quote]

if you go to the helper file there are comments explaining what each function does. Wink
#4

[eluser]BlueScreenJunky[/eluser]
Thanx for the reply !
That's not really my problem though : the helpers are working fine by themselves (it's actually pretty straightforward), I'm more concerned about the structure of my project. I guess my question is more about MVC in general than Code Igniter's specific functions.
#5

[eluser]Samus[/eluser]
[quote author="BlueScreenJunky" date="1335255314"]
Now the thing is, I'd like to use the typography helper, smiley helper, and add a few things of my own before displaying the posts/comments. [/quote]
example?
#6

[eluser]Aken[/eluser]
If you want to modify content that is output to a view before sending it to a view, you can do it in the controller. Or, if you're doing the same things in multiple places of your application, you can create your own helper or library to do it so you don't repeat your code.
#7

[eluser]astroanu[/eluser]
[quote author="Samus" date="1335459195"][quote author="BlueScreenJunky" date="1335255314"]
Now the thing is, I'd like to use the typography helper, smiley helper, and add a few things of my own before displaying the posts/comments. [/quote]
example?[/quote]

indeed an example will do Big Grin




Theme © iAndrew 2016 - Forum software by © MyBB