Not sure where to begin on my latest problem...
Here goes...
So I am wrapping up my first website, which is a "portal" on Small-Business.
It was completely hand-coded, and doesn't use anything like WordPress. (Yuck!)
Everything has been working great, except for this "tiny* little problem I discovered last week...
All of my effort over the last year has been spent on making my website more "interactive" by adding features like User Accounts, Private Messaging, Friending, Subscriptions, Profiles, etc.
All of this works great, except I realized a few weeks ago that I didn't do a very good job planning what to do when my CONTENT grows!!!
Currently, all Articles are stored in MySQL.
And here is my current "Pretty URL" scheme...
http://local.debbie/articles/postage-meters-can-save-you-money
http://local.debbie/articles/consider-becoming-an-s-corporation
http://local.debbie/articles/when-to-hire-a-consultant
Once I get 20-30 Articles, this structure will be a real drag for Users, because no one will want to scroll down through 30 Articles in my Article Index Page!
It would be nice to be able to add Sections "on-the-fly" and not break all of my Article-related scripts along the way.
Something like this seems more scalable while keeping my "Pretty URL's"...
http://local.debbie/articles/finance/postage-meters-can-save-you-money
http://local.debbie/articles/legal/consider-becoming-an-s-corporation
http://local.debbie/articles/management/when-to-hire-a-consultant
Or like this...
http://local.debbie/finance/postage-meters-can-save-you-money
http://local.debbie/legal/consider-becoming-an-s-corporation
http://local.debbie/management/when-to-hire-a-consultant
I feel fairly comfortable with mod_rewrite's, but I think my problem is much more complex for this reason...
In my "articles" directory, I have several scripts that relate to an Article...
- "add_comment.php"
- "edit_comment.php"
- "rate_article.php"
- "report_comment.php"
- "join_thread.php"
In those scripts, I have code that is looking for the Article in the "article" directory like this...
PHP Code:
// ******************
// Set Return Path. *
// ******************
if (empty($_SESSION['articleReturnPath'])){
// Store Path to Original Article.
$_SESSION['articleReturnPath'] = (isset($_SESSION['returnToPage']) ? $_SESSION['returnToPage'] : "/articles/$slug");
}
PHP Code:
// Change Redirect from "article.php" to "rate_this_article.php"
$_SESSION['returnToPage'] = "/articles/rate-this-article/$slug";
Both of those code snippets are EXTREMELY INFLEXIBLE, because if I add "finance" and "operations" directories, then - as I see it - I would need to have TWO SCRIPTS to support the different Article locations?!
Not sure if I am making sense,
and I PRAY that I don't have to re-write my entire website because of this seemingly innocent oversite on how my Articles will be structured...
Any idea of where to begin on this problem???
Thanks,
Debbie