We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 12379
    • 460 Posts
    I’m integrating a Wayfinder menu inside a forum but the links are appending to the forum’s baseurl, ie http://www.mysite.com/forum/ instead of the MODx’s baseurl, http://www.mysite.com/. Is there some other way of configuring WF to use MODx’s baseurl?

    I’m using this method to integrate: http://wiki.modxcms.com/index.php/MODx_site_menu_in_external_PHP_app
      Mostly harmless.
      • 12379
      • 460 Posts
      Sorted. Borrowing from Tim here, http://wiki.modxcms.com/index.php/MODx_site_menu_in_external_PHP_app, in the php file containing all the modx stuff I’ve inserted into the forum template, I’ve added to the top:

      define('MODX_SITE_BASE_URL', '/');


      And then after:

      $modx->connect();
      $modx->getSettings();


      ... I’ve added:

      $modx->config['base_url'] = MODX_SITE_BASE_URL; 


      ie
      <?php
      
      // ----- CONFIG -----
      $path = dirname(__FILE__).'/'; // '/path/to/api/file'
      define('MODX_SITE_BASE_URL', '/');
      // ------------------ 
      
      include_once($path.'modxapi.php');
      
      $modx = new MODxAPI();
      // connect to db and load settings
      
      $modx->connect();
      $modx->getSettings();
      
      // Set the base URL for any MODx snippets
      $modx->config['base_url'] = MODX_SITE_BASE_URL; 
      
      $html= $modx->runSnippet('Wayfinder', array('startId' => '0', 'level' => '2', 'parentClass' => 'trigger', 'parentRowTpl' => 'p7expParentRow',  'outerTpl' => 'p7expOuter', 'innerTpl' => 'p7expInner', 'rowTpl' => 'p7expRow', 'outerClass' => 'navbar'));
      
      echo $html;
      
      ?>

        Mostly harmless.