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 53601
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T17:05:20+00:00 2026-05-10T17:05:20+00:00

So I’m writing a framework on which I want to base a few apps

  • 0

So I’m writing a framework on which I want to base a few apps that I’m working on (the framework is there so I have an environment to work with, and a system that will let me, for example, use a single sign-on)

I want to make this framework, and the apps it has use a Resource Oriented Architecture.

Now, I want to create a URL routing class that is expandable by APP writers (and possibly also by CMS App users, but that’s WAYYYY ahead in the future) and I’m trying to figure out the best way to do it by looking at how other apps do it.

  • 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. 2026-05-10T17:05:21+00:00Added an answer on May 10, 2026 at 5:05 pm

    I prefer to use reg ex over making my own format since it is common knowledge. I wrote a small class that I use which allows me to nest these reg ex routing tables. I use to use something similar that was implemented by inheritance but it didn’t need inheritance so I rewrote it.

    I do a reg ex on a key and map to my own control string. Take the below example. I visit /api/related/joe and my router class creates a new object ApiController and calls it’s method relatedDocuments(array('tags' => 'joe'));

    // the 12 strips the subdirectory my app is running in $index = urldecode(substr($_SERVER['REQUEST_URI'], 12));   Route::process($index, array(     '#^api/related/(.*)$#Di'    => 'ApiController/relatedDocuments/tags',      '#^thread/(.*)/post$#Di'    => 'ThreadController/post/title',     '#^thread/(.*)/reply$#Di'   => 'ThreadController/reply/title',     '#^thread/(.*)$#Di'         => 'ThreadController/thread/title',      '#^ajax/tag/(.*)/(.*)$#Di'  => 'TagController/add/id/tags',     '#^ajax/reply/(.*)/post$#Di'=> 'ThreadController/ajaxPost/id',     '#^ajax/reply/(.*)$#Di'     => 'ArticleController/newReply/id',     '#^ajax/toggle/(.*)$#Di'    => 'ApiController/toggle/toggle',      '#^$#Di'                    => 'HomeController', )); 

    In order to keep errors down and simplicity up you can subdivide your table. This way you can put the routing table into the class that it controls. Taking the above example you can combine the three thread calls into a single one.

    Route::process($index, array(     '#^api/related/(.*)$#Di'    => 'ApiController/relatedDocuments/tags',      '#^thread/(.*)$#Di'         => 'ThreadController/route/uri',      '#^ajax/tag/(.*)/(.*)$#Di'  => 'TagController/add/id/tags',     '#^ajax/reply/(.*)/post$#Di'=> 'ThreadController/ajaxPost/id',     '#^ajax/reply/(.*)$#Di'     => 'ArticleController/newReply/id',     '#^ajax/toggle/(.*)$#Di'    => 'ApiController/toggle/toggle',      '#^$#Di'                    => 'HomeController', )); 

    Then you define ThreadController::route to be like this.

    function route($args) {     Route::process($args['uri'], array(         '#^(.*)/post$#Di'    => 'ThreadController/post/title',         '#^(.*)/reply$#Di'   => 'ThreadController/reply/title',         '#^(.*)$#Di'         => 'ThreadController/thread/title',     )); } 

    Also you can define whatever defaults you want for your routing string on the right. Just don’t forget to document them or you will confuse people. I’m currently calling index if you don’t include a function name on the right. Here is my current code. You may want to change it to handle errors how you like and or default actions.

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

Sidebar

Ask A Question

Stats

  • Questions 263k
  • Answers 263k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer No, Scavenger is right, you have to use the $_SESSION… May 13, 2026 at 12:00 pm
  • Editorial Team
    Editorial Team added an answer Because you can't. In C++ language fully-qualified names are only… May 13, 2026 at 12:00 pm
  • Editorial Team
    Editorial Team added an answer Every sample code I saw use a computation for the… May 13, 2026 at 12:00 pm

Related Questions

I want use html5's new tag to play a wav file (currently only supported
In order to apply a triggered animation to all ToolTip s in my app,
this is what i have right now Drawing an RSS feed into the php,
I have text I am displaying in SIlverlight that is coming from a CMS
I have a French site that I want to parse, but am running into

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.