Welcome Guest, Not a member yet? Register   Sign In
Long, static text (not from DB) - Model, View or Controller?
#1

[eluser]dsentker[/eluser]
Hi again,

another "noob" question, i need this for my consideration.

If i want to display, for example, a lot of news entrys, i allocate the Model to get the Entrys from Database, and the Controller will send it to a view i created. But what is to do if there is a long, static text - for example, a few paragraphs in a "about me" page? This text is a static text, where is no important or frequently need to change it later, constisting of three or four paragraphs (<p>'s and </p>'s). Additionally, a DB-based (MySQL etc) content-source is not that what i would use for a small website.

Idea 1:
I will put the static long text directly into the view file. Disadvantage: I want to use the view files as general wireframes: Instead of a use of many view files (aboutme-view.php, contactus-view.php, learnmore-view.php etc.) i want to use only a few view files (two_columns-view.php, main_with_banner-view.php etc.). If i add text to the view files, i cant use this view for another Controller. I hope my compunction is understandable..

Idea 2:
I will insert the static text in XML Files. Now i can load this content with the Model (right?) and put it into any view i like. This is my favourite idea, but is it right?

Idea 3:
I can write the text directly as a variable into a controller i like. Disadvantage: The Text will be hard to maintain. Additionally, it will be annoying and poor to escape all special chars and quotes in a paragraph for the use in a PHP variable.

So what i can do? Is my Idea Nr. 2 the right? Or am i wrong?


Messages In This Thread
Long, static text (not from DB) - Model, View or Controller? - by El Forum - 12-28-2009, 03:13 PM



Theme © iAndrew 2016 - Forum software by © MyBB