We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 25663 MODX Staff
    • 12,272 Posts
    That’s an error with MakeURL function in document.parser.class.inc.php. Will be fixed in 0.9.2, but until then, replace with:

        function rewriteUrls($documentSource) {
    
                // rewrite the urls
                if($this->config['friendly_urls']==1) {
                        $aliases = array();
                        foreach ( $this->aliasListing as $item ) {
                                $aliases[$item['id']] = ( strlen( $item['path'] ) > 0 ? $item['path'] . '/' : '' ) . $item['alias'];
                        }
                        $in = '!\[\~([0-9]+)\~\]!ise'; // Use preg_replace with /e to make it evaluate PHP
                                $isfriendly = ( $this->config['friendly_alias_urls'] == 1 ? 1 : 0 );
                                $pref = $this->config['friendly_url_prefix'];
                                $suff = $this->config['friendly_url_suffix'];
                                $thealias = '$aliases[\\1]';
                                $found_friendlyurl = "\$this->makeFriendlyURL('$pref','$suff',$thealias)";
                                $not_found_friendlyurl = "\$this->makeFriendlyURL('$pref','$suff','".'\\1'."')";
    //                              $out = '('.$isfriendly.' ? (isset('.$thealias.') ? ' . $found_friendlyurl . ' : '.$not_found_friendlyurl.') : ' . $not_found_friendlyurl . ')';
                                $out = "({$isfriendly} && isset({$thealias}) ? {$found_friendlyurl} : {$not_found_friendlyurl})";
                        $documentSource = preg_replace($in, $out, $documentSource);
                }
                else {
                        $in = '!\[\~([0-9]+)\~\]!is';
                        $out = "index.php?id=".'\1';
                        $documentSource = preg_replace($in, $out, $documentSource);
                }
                return $documentSource;
        }
    
      Ryan Thrash, MODX Co-Founder
      Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
      • 6726
      • 7,075 Posts
      Thanks Mark for the update, thanks Ryan for the fix smiley

      I’ll try that out !
        .: COO - Commerce Guys - Community Driven Innovation :.


        MODx est l'outil id
        • 1876
        • 835 Posts
        Hi

        I udpate newslisting and document.parser.class.inc.php

        When a news is display :

        The url of the title is :
        http://mondomaine.net/[~~]

        the url of the more link :
        http://mondomaine.net/urlsimple.html


        So if I click on the title of the news I’am redirect to the root

        Aour
          • 18397
          • 3,250 Posts
          Hmmmmm. That shouldn’t be possible as both use the same bit of code... [~[+id+]~]

          Are you sure your title has that as its link?
            • 18397
            • 3,250 Posts
            Fixed, I missed a [+ somewhere..... 6.3.2
              • 18397
              • 3,250 Posts
              NewsListing Version 6.3.2
              CRITICAL UPDATE

              Fixed previous bug.
                • 1876
                • 835 Posts
                Hi

                It’s OK. thank’s Mark

                Next time I will waiting the version 6.X.999 laugh

                Aour
                  • 33453
                  • 141 Posts
                  Mark,

                  I notice in 6.3 you have abandoned the API method for resolving placeholders in favour of the direct str_replace method. Any particular reason?

                  The reason I ask is that I have added a placeholder of my own

                  Also the version in the file header for 6.3.2 still says 6.3.1.

                  Thanks.
                    • 18397
                    • 3,250 Posts
                    Also the version in the file header for 6.3.2 still says 6.3.1...

                    Sorry about that! I put in a bugfix Jason made right before I had to leave (I was running late) so I didn’t get a chance to change that.

                    I changed from placeholders to a str_replace because the API function I was using to merge the placeholders was

                    a) Out of date
                    b) Related to a bug where if a placeholder’s value is blank then it will use the last set value of the placeholder...

                    So, I pulled out the raw parts of the API I needed and with Jason’s help turned it into an str_replace that is alot more reliable.
                      • 33453
                      • 141 Posts
                      Quote from: Mark at Jan 22, 2006, 01:32 PM

                      b) Related to a bug where if a placeholder’s value is blank then it will use the last set value of the placeholder...

                      Yes - I found that one grin

                      I have added 2 placeholders, [+linktoparent+] and [+parentlinktext+]. The first returns $resourceparent and the second whatever I pass in $archivetext.

                      This enables me to have generated links with the text "More News", "More Reviews" etc.

                      As always, if you can think of a better way to do this I would like to hear.

                      Thanks.