Jump to content

Which approach is more effiecient - file or db entry?


ICEcoffee

Recommended Posts

Hi, I am in the early stages of developing a web app in PHP/MySQL. It is predominantly procedural (with type of MVC approach)in coding style though I do have some classes included().

 

ATM, I have my navigation links going straight to a bare-bones file that sets up variables for that page, such as: $pageAuthLevel, $metaPageTitle, $metaPageContent, $metaPageKeywords. Also defined in this page is the include paths for the actual html content file, the pages controller and lastly the pages view.

 

I know I could include all this data in a MySQL db table and the include files from within the controller.

 

The advantage of doing it the way I have it currently, is that the links are already written in an SEO friendly manner eg: /about-this-site.php and saves me from having to learn and setup mod_rewite in an .htaccess file. The disadvantage is that I have an additional file for every 'content' file, but the filesize is small and disk space is cheap.

 

My question is though, which method is more efficient in terms of performance,  scalability and security?

Link to comment
Share on other sites

I would learn mod_rewrite.

 

This has to do with maintainability.  Having to to touch 100, 1000, or w/e php files to update something, even using a function to do it is a pain and error prone.  It is a bad habit to rely on something "cheaper" that works when you could do it "right"[in this case a more easily managed method], the first time.

 

It's up to you, but I've seen a fair amount of mod_rewrite tuts out there that I'm sure you could learn if it would help you out enough.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.