Welcome Guest, Not a member yet? Register   Sign In
Better to store HTML in DB or flat files?
#1

[eluser]Jay Logan[/eluser]
I built a site with CI and use several view files to display the pages. My customer now wants the ability to edit those pages from the web browser. Which is a pain since I chose to use CI code as much as I can (HTML helper, URL helper, etc.). My dilemma is should I store all the HTML code in a database or show I make the site fopen() the view files for editing. And recommendations for a good WYSIWYG editor?
#2

[eluser]eoinmcg[/eluser]
Hi J-Slim,

Personally I'd stored it in the database. I have some vague idea that this will be quicker than the fopen function, but no benchmarks to back it up Smile Also when the client comes back and asks for search etc it'll be easier to do it if the content is in a database.

As for richtext editor, I've been using TinyMCE for a couple of years and it does the job nicely.
#3

[eluser]Yorick Peterse[/eluser]
Page content itself should be stored into a database, while raw HTML should be in a view file. You could have something like the following in a view file:

Code:
<div id="something">
     &lt;?php echo $content; ?&gt;
</div>

Ofcourse you will have to create the variable $content that will contain the text output Smile
#4

[eluser]Dam1an[/eluser]
I'm assuming that when you say the client wants to edit the pages, you mean the content, not the structure/style of them?
If so, I'd do as Yorick says, and just have placeholders in you view for the content, which is fetched from the database
#5

[eluser]MeanStudios[/eluser]
I would definitely store it in the database. If you've ever worked with ExpressionEngine, you'll notice EL does the same thing. That way you can also do revisions just in case your client wants to be able to undo what they've just done Smile.




Theme © iAndrew 2016 - Forum software by © MyBB