Grow your CSS skills. Land your dream job.

code snippets: best practice

  • # December 15, 2012 at 1:47 pm

    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??

    # December 15, 2012 at 1:57 pm

    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.

    # December 15, 2012 at 2:04 pm

    Of course! JSON! or perhaps YAML.

    Good one!

    # December 15, 2012 at 4:42 pm

    Personally, I prefer JSON.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".