I was thinking of adding a code snippet type area to my site, and I am wondering what the best way of doing it is.
I have thought of a few ways to do this.
The first is to store all files(css, php, java, ruby, etc.) in directories according to type.
Then have php scan the directories and show them on the page.
Or I could store all of the code in the database, which seems annoying.
I could also have a static page that I edit whenever I add a new piece of code, this would load faster, but it would be annoying to maintain.
What do you think??
I think something like that depends on how many snippets you’ve got. If you’ve got loads then I’d look at the database option, or if you’re not wanting to down database drive you would look at JSON and have a PHP file read and display snippets.
Of course! JSON! or perhaps YAML.
Personally, I prefer JSON.
You must be logged in to reply to this topic.