We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 29556
    • 6 Posts
    It error in /manager/processors/save_content_processors.php.

    // check if alias already exists. if yes then append $cnt to alias
    		$cnt = $modx->db->getValue("SELECT count(*) FROM " . $tblsc . " WHERE id<>'$id' AND alias='$alias'");
    		if ($cnt > 0)
    			$alias .= $cnt;


    That takes place:
    1. At creation of aliasa existence is checked up the same and their amount.
    2. At finding - an amount adds to the name of aliasa and saves.

    That for example name a "new 1" - alias of "novost-1" is created. Saved.
    If to create another "new 1" - another alias of "novost-1" is created - a script sees that it is an evil and "1" adds - "novost-11".
    But! If to create another "new 1" - alias of "novost-1" is created again - a script again sees that it is an evil and the amount of such aliasov considers again, but as the past found is already renamed, "1" is again added.
      • 16429
      • 254 Posts
      I’ve had problems with pages with the same name because the save_content.processor (in 0.9.6.1 AND in 0.9.6.2) still adds only a "1" after an alias, and it makes trouble to reach certain pages.

      I’ve corrected the save_content.processor.php replacing lines 69->71 (the one you pointed) with this:
      		if ($modx->db->getValue("SELECT count(*) FROM " . $tblsc . " WHERE id<>'$id' AND alias='$alias'") != 0) {
      			$cnt = '1';
      			$tempAlias = $alias;
      			while ($modx->db->getValue("SELECT count(*) FROM " . $tblsc . " WHERE id<>'$id' AND alias='$tempAlias'") != 0) {
      				$tempAlias = $alias;
      				$tempAlias .= $cnt;
      				$cnt++;
      			}
      		$alias = $tempAlias;
      		}
      


      Now it works for me, and even if I have pages with aliases like news, news1, news2 it gives the correct news3 next alias.
        kudo
        www.kudolink.com - webdesign (surprised?)

        [img]http://www.kudolink.com/kudolinkcom.png[/img] [sup]proudly uses[/sup] [img]http://www.kudolink.com/modx.png[/img]
        • 3749
        • 24,544 Posts
        Would you please report this and your fix at the "Bugs & Requests" link at the top of this page.
          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
          • 16429
          • 254 Posts
          Done.
          I hope the summary and description is understandable.

          MODX-341
            kudo
            www.kudolink.com - webdesign (surprised?)

            [img]http://www.kudolink.com/kudolinkcom.png[/img] [sup]proudly uses[/sup] [img]http://www.kudolink.com/modx.png[/img]
            • 6726
            • 7,075 Posts
            Cool, I have noticed this one on one of my install and was meaning to signal it... thanks kudolink smiley
              .: COO - Commerce Guys - Community Driven Innovation :.


              MODx est l&#39;outil id