We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 15582
    • 5 Posts
    I downloaded Docfinder http://modxcms.com/extras/package/?package=103 and installed it on modx-1.0.0. Docfinder is absolutely necessary, since I am importing a very big "static" html site with many internal links which have to be found and replaced.

    When I opened the Search in the Manager, I got this message:

    Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in C:\xampp\htdocs\04kelebek\manager\processors\execute_module.processor.php(114) : eval()’d code on line 1

    I tried playing around with the code in a more or less random fashion, to no avail.

    I know T_CONSTANT_ENCAPSED_STRING has something to do with use/misuse of quotes.

    Any suggestions?
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      The problem is on the first line of the module code. Do you have extraneous <?php tags? Are the comments properly marked, or did something get lost in the copy/paste?
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 15582
        • 5 Posts
        Thank you for your very prompt reply!

        I know very little about php, so I suppose you will find my answer far from the point.

        I simply followed the installation instructions (unzip, download to, make new module etc.). The module code I pasted in - copying from the website - was

        include($modx->config’base_path’."assets/modules/docfinder/index.php")

        since it is not very clear where the code begins or ends, the problem just might be there.

        I suppose it would be anti-etiquette to post the whole .php file, so here are the first lines:

        <?php
        if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b>

        Please use the MODx Content Manager instead of accessing this file directly.");
        if(!$modx->hasPermission(’exec_module’)) {
        $e->setError(3);
        $e->dumpError();


        Here is the part of the module.processor.php file referring to eval (lines 105 to 127).

        // evalModule
        function evalModule($moduleCode,$params){
        global $modx;
        $etomite = &$modx;
        $modx->event->params = &$params; // store params inside event object
        if(is_array($params)) {
        extract($params, EXTR_SKIP);
        }
        ob_start();
        $mod = eval($moduleCode);
        $msg = ob_get_contents();
        ob_end_clean();
        if ($php_errormsg) {
        if(!strpos($php_errormsg,’Deprecated’)) { // ignore php5 strict errors
        // log error
        global $content;
        $modx->logEvent(1,3,"<b>$php_errormsg</b>

        $msg",$content[’name’]." - Module");
        if($modx->isBackend()) $modx->event->alert("<span style=’color:maroon;’><b>".$content[’name’]." - Module"." runtime error:</b></span>

        An error occurred while loading the module. Please see the event log.");
        }
        }
        unset($modx->event->params);
        return $mod.$msg;
        }
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          The error is in line 1 of the module code (the part "eval()’d code on line 1" tells us that); since it’s a 1-liner that means the error is there. From what you pasted, there is no ; at the end of the include directive.

          Looking at that again, it’s also missing the array brackets:
          include($modx->config['base_path']."assets/modules/docfinder/index.php");

          That’s a common problem with copy/pasting directly from a web page. I always use the browser’s "view source" function and copy from there; or at least from there I can see any HTML encoding that’s been done that will break the code.
            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org
            • 15582
            • 5 Posts
            False alarm and profound apologies from the usual newbie!

            Instead of first extracting the zip into a new folder and then putting it into assets/modules, I had directly extracted the zip into assets/modules, which of course changed the position of every file.

            Deleted, reinstalled, everything ok, and sorry to have bothered you.

            However (OT), I downloaded docfinder, because Bob’s Guide says:

            If there are links on the page, wait to correct them until you have created the documents they point to. Then, make a note of their document ID numbers (in parentheses in the document tree at the left side of the Manager screen) and change the links to look like this (using the actual document ID numbers instead of "999"):

            <a href="[~999~]">My link</a>

            My site has an enormous number of in-site links built up over ten years - over one thousand pages, very many linking to each other with cross-references. With docfinder, I can look for every old url that is linked to and correct it one by one (hoping I never get one id mixed up), but before dedicating the coming winter to this job, I wonder whether there might not be a simpler way, exploiting the friendly url system.

              • 10449
              • 956 Posts
              If you can use the same URLs on your new site, just leave it as it is.

              e.g.
              old link = my-page.html
              MODx document alias = my-page (+ suffix .html, obviously)
                • 15582
                • 5 Posts
                Quote from: ganeshXL at Aug 26, 2009, 10:13 AM

                If you can use the same URLs on your new site, just leave it as it is.

                e.g.
                old link = my-page.html
                MODx document alias = my-page (+ suffix .html, obviously)


                That’s exactly what I wanted to do, and I had the impression it was possible.

                When I imported the site, I set as default; xhtml urls, use friendly urls, use friendly aliases (maybe too many things?)...

                but in the manager, the in-site links do not work.

                E.g., my old page my-page1.htm had a link to my-page2.htm.

                my-page1.htm has now become index.php?id=212.

                my-page2.htm has now become index.php?id=150. Both pages are clearly accessible from the tree.

                If I open index.php?id=212 and click where the link to my-page2.htm is, I don’t get
                index.php?id=150; I get a blank error 404 page.

                If in the manager I try to open http://localhost/mysite/my-page2.htm, I also get a 404.

                When I read in Bob’s Guide what I quoted in my previous post, I had the impression that there was no way of making the old url’s work.

                If there is, you can count on me for a pizza if you ever come by Florence (Italy).
                  • 10449
                  • 956 Posts
                  You probably didn’t yet enable URL-rewriting in your .htaccess file.
                    • 15582
                    • 5 Posts
                    After a little tinkering, I seem to have fixed it... The pizza is yours.

                    Contrary the comment at the end of the http://wiki.modxcms.com/index.php/Friendly_Url’s_Guide, there seems to be no problem with the Apache httpd.conf settings in Xampp, at least in its latest version.

                    The Guide keeps telling you what to do with "pre 0.9.5 MODx", whereas I use 1.0.0. Also the .htaccess code looked quite different.

                    In the end, I pasted up this:

                    RewriteEngine On
                    RewriteBase /myfolder
                    RewriteCond %{REQUEST_FILENAME} !-f
                    RewriteCond %{REQUEST_FILENAME} !-d
                    RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

                    Nothing happened however until I enabled "allow duplicate aliases" in tools -> configuration.