Child pages
  • [cms] Greedy template detection durning url parsing [5.2.2-B1]
Skip to end of metadata
Go to start of metadata

The Front-End URL parsing code in In-Portal is build in a way to allow dealing with most complex URLs with ease. Typical URL can consist of these components:

  • language (e.g. "english")
  • theme (e.g. "advanced")
  • anything before category (not used by default)
  • category (e.g. "path/to/category")
  • anything after category (e.g. "article-name")
  • template ("path/to/template")

All parsing, except template happens from left to the right. The template is parsed from right to the left, because:

  • if present, then it's always specified at the end of url
  • most likely something else would come before template, e.g. category

This however is a problem when template is part of some other non-related category. For example:

 URLCategoryTemplateIssue Description
1platform/login/register.htmlHome > Platform/platform/login/register.tplCategory was partially detected from template, but it's not related to template in any way.
2modern/search-results.htmlModern > Search Results/search-results.tplTemplate was partially detected from category and prevented category design to be used.


  1. in the "\kRewriteUrlProcessor::_parsePhysicalTemplate" method:
    • compare current $vars['t'] (populated from category parsing) and new $vars['t'] (populated from template parsing), but prior to adding "/index"
    • if detected category path is completely within detected template, then patch $vars['m_cat_id'] in a way to emulate fact, that category wasn't detected at all
    • if detected template is completely within detected category path, then don't change $vars['t'] and return false

Related Discussions

Related Tasks