We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37131
    • 111 Posts
    How Friendly URL links are translated in MODx ? I mean how they are decoded and how MODx knows what to do with path elements ?
      ---
      Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live. Martin Golding
      • 32316
      • 387 Posts
      .htaccess directs the request to index.php
      at the end of index.php you will find
      /* execute the request handler */
      if (!MODX_API_MODE) {
          $modx->handleRequest();
      }

      search for 'handleRequest' and the most promising result is
       /**
           * The primary MODX request handler (a.k.a. controller).
           *
           * @return boolean True if a request is handled without interruption.
           */
          public function handleRequest() {
              $this->loadErrorHandler();
      
              $this->sanitizeRequest();
              $this->modx->invokeEvent('OnHandleRequest');
              if (!$this->modx->checkSiteStatus()) {
                  header('HTTP/1.1 503 Service Unavailable');
                  if (!$this->modx->getOption('site_unavailable_page',null,1)) {
                      $this->modx->resource = $this->modx->newObject('modDocument');
      ...snip... function is about 70 lines of code
      

      found in model/modx/modrequest.class.php

      The rest as they say is left as exercise for the reader!!!

      OK - a bit more on down the same file a bit
      /**
           * Gets the method used to request a resource.
           *
           * @return string 'alias', 'id', or an empty string.
           */
          public function getResourceMethod() {
              $method = '';
              if ($this->modx->getOption('request_method_strict', null, false)) {
                  $method = $this->modx->getOption('friendly_urls', null, false) ? 'alias' : 'id';
              } else {
                  if (isset ($_REQUEST[$this->modx->getOption('request_param_alias',null,'q')])) {
                      $method = "alias";
                  } elseif (isset ($_REQUEST[$this->modx->getOption('request_param_id',null,'id')])) {
                      $method = "id";
                  }
              }
              return $method;
          }


      good luck sleuthing , have fun and why do you want to know? [ed. note: whistlemaker last edited this post 12 years, 1 month ago.]
        • 37131
        • 111 Posts
        I am trying to get FURLs of tags working in Articles Add-on. I saw that Resource is responsible for generating FURL paths so I want to know how to check if the FURL path is right.
        I till need: how it is translated back and how parameters are passed to resource in FURL mode. [ed. note: khyrlik last edited this post 12 years, 1 month ago.]
          ---
          Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live. Martin Golding