We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 33101
    • 46 Posts
    Along with my Mohana (MODx+Kohana) project, there is a plugin for MODx does not need Kohana that others might find useful. It’s called pathinfo - taken from the README at http://github.com/yehosef/Mohana



    PATHINFO PLUGIN - INSTRUCTIONS:
    1) create a plugin called pathinfo
    require_once($_SERVER[’DOCUMENT_ROOT’].’/pathinfo.php’);
    listen to "OnPageNotFound" event

    2) create a TemplateVariable called pathinfo with the following settings
    Description: checking yes will make it capture 404 descendents; only no will not; unchecking both will inherit
    Input Type: Checkbox
    Input Option Values: Yes==1||No==0
    Default Value: @INHERIT 0

    Then set the template access to any templates you would like to use it.

    USAGE:
    If you have a page called "blog/archive" with no children, normally if you would try /blog/archive/2009/ you would get a
    404. If you have pathinfo set to yes for blog/archive, then it would load the document /blog/archive with a variable
    $modx->pathinfo="2009". If you have a snippet in the page, you can then check for the $modx-pathinfo variable and
    server the appropriate content.

    The Modx_Controller included will map the extra pathinfo into the arguments - eg if the modx page /blog/archives has a
    snippet call [!KO?uri=`blog/old`!] and Blog_Controllers extends Modx_Controller then calling the page
    /blog/archives/2009/12 would be the same as calling from the web /apps/blog/old/2009/12.

    This plugin is not specific to kohana.