Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6619047
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:54:59+00:00 2026-05-25T20:54:59+00:00

I’ve been putting together a database to handle content produced for a site, however,

  • 0

I’ve been putting together a database to handle content produced for a site, however, thinking about the long-term, I’m unsure if I have the best system.

At present I’m using the routing method of passing everything via index.php which .htaccess routes as follows index.php?route=example/url (user sees http://www.domain.com/example/url)

At present the database is setup like below:

uid            | title        | content | category
--------------------------------------------------
/              | Home         | aaa     | 1
/example       | Example      | bbb     | 2
/example/url   | Example: URL | ccc     | 2

Though I am not sure if this is the best approach, especially if I wanted to rename example to something – I’d have to rename each URL…

So I’ve also thought about the Nested Set method (such as http://www.phpclasses.org/package/2547-PHP-Manipulate-database-records-in-hierarchical-trees.html) though this would just show lots of different numbers in the database where I could access everything by it’s node. Example below;

node | left | right | name
--------------------------
1    | 1    | 6     | Home
2    | 2    | 5     | Example
3    | 3    | 4     | URL

Then I could use the node as the uid? But I’m unsure how I could translate http://www.domain.com/example/url to the uid equalling 3…

I already do have a category column in my database at the moment, to categorise the content, though I could potentially alter this.

I’m basically looking for suggestions about how to proceed, because as the site gets more content it will be harder to change the setup – so I want to ideally get this right from day one.

  • Which of the two is better for scalability?

  • If the second, how to translate the URL to the node?

  • Could I somehow combine both so that the original database stores the uid as the node number, then do a join of some sort to make the uid be a url (as in 1) – then ]

    ^ I think I’d prefer this (the third), but unsure how to do in MySQL exactly, with some other benefits:

    • I could replace my category system with the parent node – which may be better
    • I could also then in theory store the node ID within a stats system, rather than a URL

If anyone can give some help/suggestions – I’d be grateful!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T20:54:59+00:00Added an answer on May 25, 2026 at 8:54 pm

    The nested set model probably is a good choice here. That’d result in a table layout like (id,left,right are the fields required by the nested set model, the others contain the respective content):

    | id | left | right | uid | title | content | category |
    

    More details on how to perform a particular query can be found here.

    However I would not perform the look up on the database but a simple array cache:

    new array('/' => array('content' => 'aaa', 'category' => 'bbbb'),
              '/example/' => array(),
              .....
    );
    

    This cache can be build up very easy (though expensive) and queried very easy.

    On a side note: i suspect you’re trying to model page content here. Maybe you should refactor you database structure then as this table would have two responsibilities (url->content mapping and content).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a reasonable size flat file database of text documents mostly saved in
I am using Paperclip to handle profile photo uploads in my app. They upload
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.