Easy Question, Opinion on URL Scope/Bootstrap?

So I have a bootstrap object, and it breaks down the URL right.
Bootstrap is the lowest level object.

I want to be able to tell my models what the URL parts are.

If you are wondering why just read the PS at the bottom. Sorry if this sounds confusing, the more I write the more time I feel like Im wasting of anyone reading this.

It would be easiest to just make a constant like below:

private function _Get_URL()
  // Pretend the url got exploded

  define('URI_CTRL', (isset($url[3])) ? $url[0] : NULL);
  define('URI_FUNC', (isset($url[3])) ? $url[1] : NULL);
  define('URI_VAL', (isset($url[3])) ? $url[2] : NULL);
  define('URI_EXTRA', (isset($url[3])) ? $url[3] : NULL);

Is that a bad idea? Since the constant can be accessed anywhere? I don’t think it’s threatening data at all as it comes straight from the URL.

I don’t want to couple up just for URL parameters to get into the model like this…

$this->Model = new Model($URL);

I wish you could do like…

// (Pretend Im inside of Model)
$this->__parent->$property;  // When its not extended, but only instantiated inside of it, know what i mean?

Anyways, does anyone have an opinion about doing a constant like that to store the URL things? Is it a bad idea to do? Or is it ok?

[I]PS: Mainly the reason is for the URI_EXTRA for page refreshes to keep SEO friendly url if someone posts a page… :stuck_out_tongue:

  1. So if they are at…

  2. Then they post a comment, It doesn’t refresh to:

  3. So i can preserve that text without wasting a query fetching a title.

Constants that are actually variables = bad. You may as well keep them as variables and use the global keyword.

Pass $url to the model.

But… should the model be exposed to the url? Should it care/know about the concept of a ‘url’ or program arguments?

I’d argue that you shouldn’t really be initiating models in the bootstrap either.