Web Development/To db or not to db?

From Wikibooks, open books for an open world
Jump to navigation Jump to search
Section 5.2 — Back to Contents

To determine whether your site needs a database you need to examine how often you update your site, how much content you have, what your content is, how your site is updated, and more.

Automatic reasons to use a database is when you have a lot of content, content that is easiest to access through categories, if your site it updated by more than 2 people. If you update your site daily that implies having enough content to justify a database.

Other Technology Options

[edit | edit source]

If a database isn't right for your site but you are still looking for ways to ease site updates, here are some options for you to consider.

SSI, or server side includes are good to use for navigation menus. (They are a type of shtml, an extension of HTML that contains other useful server directives such as date and time.) By using includes, you can tell a page to include a separate file. The file will be loaded into that space when the page is loaded—like copy-pasting by hand, except that server does it for you. So, if you wanted to have the same sidebar on a number of pages, you could create the sidebar in a separate .shtml file and tell each of your websites to include that page. That way, when you needed to change the navigation bar, you could change the one .shtml file instead of changing every single page.

The code looks like this:

 <!-- #include file="navbar.shtml" -->

Remember to name your files .shtml.

PHP stands for PHP: Hypertext Preprocessor and you can do really everything with it. It works very good with databases. Some code:

 <?php print("Hello world!"); ?>

As you see, it looks like C.


[edit | edit source]

WebDNA is an easy to learn server-side scripting language specifically designed for the World Wide Web, with an Hybrid in-memory databases system making easy to build resilient database-driven websites.

Example Code (connects to a whois server and shows the information, then stores it into a permanent database)

[text]info=[tcpconnect host=whois.domaindiscover.com&port=43]

[append db=base.db]domain=webdna.us&whois=[info]