Is there a better way to store html code, other than storing it as a string in database ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Is there a better way to store html code, other than storing it as a string in database ?

I am creating a content management system and want to make an html editor through which I can make a post and edit it's source code, now the problem here is that all of the other data is not that large but the source code is large and passing the whole source code as a string doesn't seem to be a relevant technique, is there any file storing technique that I can use ?

14th Jun 2018, 1:45 AM
Ali Abbas
Ali Abbas - avatar
3 Answers
+ 7
Well you could store them as html files. Writing and reading files with php
14th Jun 2018, 1:59 AM
Toni Isotalo
Toni Isotalo - avatar
+ 2
yeah I can do that so what you're suggesting is I create an Html file for every new post also I need to add a link to the directory where that file resides in, and store that link to database, now all I need to do is figure out a way to save the file using php and grab its link !
14th Jun 2018, 6:47 AM
Ali Abbas
Ali Abbas - avatar
+ 2
I figured it out using php filing and inserting link to database !
17th Jun 2018, 5:33 AM
Ali Abbas
Ali Abbas - avatar