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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T05:19:15+00:00 2026-06-07T05:19:15+00:00

I am in the outlining phase of constructing a Routing system for a PHP

  • 0

I am in the outlining phase of constructing a Routing system for a PHP Framework I am building.

I will need to use mod rewrite, for pretty urls. I got that part covered.
But say I want to make a page with the url like:

http://www.domain.com/news/10(News-id)/

and I want this dynamic variable ( This news id ) to have a name when rewriting.

What I want to achieve is;

Frameworks routes to news controller, and passes 10 as argument as:
$args = array ( ‘news_id’ => 10 )

  • 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-06-07T05:19:17+00:00Added an answer on June 7, 2026 at 5:19 am

    You can use the $_SERVER super-global to inspect the requested URI. In your example, $_SERVER['REQUEST_URI'] will be set to something like:

    /news/10/
    

    You can then get the requested news-id from that string.

    Update

    // Use substr to ignore first forward slash
    $request = explode('/', substr($_SERVER['REQUEST_URI'], 1)); 
    $count = count($request);
    
    // At this point, $request[0] should == 'news'
    if($count > 1 && intval($request[1])) {
        // The second part of the request is an integer that is not 0
    } else {
        if( $count == 1) {
            // This is a request for '/news'
    
        // The second part of the request is either not an integer or is 0
        } else if($request[1] == 'latest') {
            // Show latest news
        } else if($request[1] == 'oldest') {
            // Show oldest news
        } else if($request[1] == 'most-read') {
            // Show most read news
        }
    }
    

    See the manual entry for $_SERVER

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

Sidebar

Related Questions

I made the following script to override the browsers' default outlining system: * {
In Visual Studio 2010 how can I disable outlining in XAML files please? Or
I'm working in Visual Studio 2008 and I would like for Edit > Outlining
As you can guess from the title, the outlining with regions finally made me
Problem/Questions: Document outlining for JavaScript files is not working in Visual Studio 2008. Is
I'm new to HTML5 and I read the outlining concept and I understood. I
I have stored procedure (unorganized - not properly outlined) I want automatic outlining in
In our daily work we maintain some rather large Javascript libaries. We use VS2008
Here is some code outlining a problem I've been wrestling with. The final problem
Can any one tell me how to turn off automatic outlining in Visual Studio?

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.