We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 25046
    • 194 Posts
    ricksterv4n1x8 Reply #1, 17 years ago
    I have a PHP page that works great when it is opened as a static web page (outside ModX). But if I try to put the page code into ModX, it doesn’t work. I think it might have to do with an include statement (or a wrong path) that is used at the top of the page - but what the heck do I know?

    I think this is a $100 problem but am definitely prepared to pay more if I can be convinced it’s necessary. Right now, I just want to get it to work and need somebody who is very conversant in PHP AND very familiar with ModX. I believe it will be an easy fix for those who know their stuff.

    Thanks!

    Rick
      • 3749
      • 24,544 Posts
      You need to put the PHP code in a snippet, if you haven’t already.

      For includes, you need to prepend MODX_BASE_PATH.

      require_once MODX_BASE_PATH . 'path_to_file';


      Depending on what the code does, sometimes you need this instead:

      return require_once MODX_BASE_PATH . 'path_to_file';


      See also the "Porting your site to MODx" page at the site in my sig. (which takes donations, BTW, although $100 is too much). wink
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting