We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 32982
    • 674 Posts
    has errors now well ,
    whith this code taken from custom alias and retouched you can save in iso format the alias in the manager....
    code::::/* <? /*
    @name: CustomAliases by Brett @ The Man Can!
    @version: 0.96, 2007-07-20
    @works with: MODx 0.9.6+
    Should work with 0.9.5 as well, but no promises.

    @inspired: Based very heaviliy on AutomaticLongtitle code by Mitch

    @what it does: Refines the automatically generated aliases:
    * Converts all áccéñtèd characters to non-accented characters.
    (Look in the replace_array below for complete list of conversions.)
    * Allows using the pub_date or createdon values in the alias.
    * Allows the ID to be used in the alias.
    * Allows the alias to be set by more than just the pagetitle.

    @known issues: QuickEdit apparently overrides and resets aliases to the doc ID.

    @changes:
    0.96 Used Ryan’s i18_to_ASCI_array.txt file.
    Commented out change from . -> -, since sometimes a dot is desired.
    Changed default alias to yyyy-mm-dd.id.
    0.92 Added question mark to replacement array
    0.91 Added punctuation to the replacement array.
    0.90 Fixed problems with the strtr function in MODx 0.9.5.1 and above.
    Added more code comments.
    Added ability to use the document’s ID in the alias. (thanks Doze.)

    @install: Paste this text into a new plugin called CustomAlias.
    Check the OnDocFormSave event checkbox.
    Customize.

    @defaults: The default output of this plugin is:
    pagetitle.yyyymmdd.id
    where yyyymmdd is set by the pub_date, createdon, or the current time,
    depending on which is available.

    @customize: Go through the code and change or comment as necessary to achieve
    desired results.
    */

    // Get the relevant dates
    $published = $_POST[’pub_date’];
    $created = $_POST[’createdon’];
    $edited = time();


    // Set which date value to use
    if ($published != ’’) {
    $date = $published;
    } elseif ($created != ’’) {
    $date = $created;
    } else {
    $date = $edited;
    }

    // Set the date formatting
    $dateFormatString = ’%Y-%m-%d’;
    $date = strftime($dateFormatString, $date);

    // Get the ID of the document, if you want to use it in your alias
    $id = $modx->event->params[’id’];

    // *****************************************************************
    // EDIT HERE:
    // *****************************************************************
    $alias_new = $_POST[’pagetitle’];
    if ($_POST[’alias’] == ’’){$alias_new = $_POST[’pagetitle’];} else{$alias_new=$_POST[’alias’] ;}
    //$alias_new = $date . ’.’ . $id;



    // *****************************************************************
    // YOU CAN STOP EDITING HERE.
    // *****************************************************************


    // The cleansing and setting of the alias.
    $e = &$modx->Event;


    // Only on this event
    if ($e->name == ’OnDocFormSave’)
    {

    // Check if the alias is empty

    // Convert accented characters to their non-accented counterparts.
    $replace_array = array(
    // Punctuation and special characters
    ’ ’ => ’-’,
    ’,’ => ’-’,
    ’?’ => ’-’,
    ’"’ => ’-’,
    ’\’’ => ’-’,
    ’,’ => ’-’,
    ’:’ => ’-’,
    ’/’ => ’-’,
    ’\\’ => ’-’,
    //’.’ => ’-’,
    ’!’ => ’-’,
    ’@’ => ’-’,
    ’#’ => ’-’,
    ’$’ => ’-’,
    ’%’ => ’-’,
    ’^’ => ’-’,
    ’&’ => ’and’,
    ’*’ => ’-’,
    ’(’ => ’-’,
    ’)’ => ’-’,
    ’[’ => ’-’,
    ’]’ => ’-’,
    ’=’ => ’-’,

    // Letters
    ’À’ => ’A’,
    ’À’ => ’A’,
    ’Ã&#129;’ => ’A’,
    ’Ã&#129;’ => ’A’,
    ’Â’ => ’A’,
    ’Â’ => ’A’,
    ’Ã’ => ’A’,
    ’Ã’ => ’A’,
    ’Ä’ => ’e’,
    ’Ä’ => ’A’,
    ’Ã…’ => ’A’,
    ’Ã…’ => ’A’,
    ’Æ’ => ’e’,
    ’Æ’ => ’E’,
    ’&#256;’ => ’A’,
    ’&#260;’ => ’A’,
    ’&#258;’ => ’A’,
    ’Ç’ => ’C’,
    ’Ç’ => ’C’,
    ’&#262;’ => ’C’,
    ’&#268;’ => ’C’,
    ’&#264;’ => ’C’,
    ’&#266;’ => ’C’,
    ’&#270;’ => ’D’,
    ’&#272;’ => ’D’,
    ’È’ => ’E’,
    ’È’ => ’E’,
    ’É’ => ’E’,
    ’É’ => ’E’,
    ’Ê’ => ’E’,
    ’Ê’ => ’E’,
    ’Ë’ => ’E’,
    ’Ë’ => ’E’,
    ’&#274;’ => ’E’,
    ’&#280;’ => ’E’,
    ’&#282;’ => ’E’,
    ’&#276;’ => ’E’,
    ’&#278;’ => ’E’,
    ’&#284;’ => ’G’,
    ’&#286;’ => ’G’,
    ’&#288;’ => ’G’,
    ’&#290;’ => ’G’,
    ’&#292;’ => ’H’,
    ’&#294;’ => ’H’,
    ’ÃŒ’ => ’I’,
    ’ÃŒ’ => ’I’,
    ’Ã&#141;’ => ’I’,
    ’Ã&#141;’ => ’I’,
    ’ÃŽ’ => ’I’,
    ’ÃŽ’ => ’I’,
    ’Ã&#143;’ => ’I’,
    ’Ã&#143;’ => ’I’,
    ’&#298;’ => ’I’,
    ’&#296;’ => ’I’,
    ’&#300;’ => ’I’,
    ’&#302;’ => ’I’,
    ’&#304;’ => ’I’,
    ’&#306;’ => ’J’,
    ’&#308;’ => ’J’,
    ’&#310;’ => ’K’,
    ’&#317;’ => ’K’,
    ’&#313;’ => ’K’,
    ’&#315;’ => ’K’,
    ’&#319;’ => ’K’,
    ’Ñ’ => ’N’,
    ’Ñ’ => ’N’,
    ’&#323;’ => ’N’,
    ’&#327;’ => ’N’,
    ’&#325;’ => ’N’,
    ’&#330;’ => ’N’,
    ’Ã’’ => ’O’,
    ’Ã’’ => ’O’,
    ’Ó’ => ’O’,
    ’Ó’ => ’O’,
    ’Ô’ => ’O’,
    ’Ô’ => ’O’,
    ’Õ’ => ’O’,
    ’Õ’ => ’O’,
    ’Ö’ => ’e’,
    ’Ö’ => ’e’,
    ’Ø’ => ’O’,
    ’Ø’ => ’O’,
    ’&#332;’ => ’O’,
    ’&#336;’ => ’O’,
    ’&#334;’ => ’O’,
    ’Å’’ => ’E’,
    ’&#340;’ => ’R’,
    ’&#344;’ => ’R’,
    ’&#342;’ => ’R’,
    ’&#346;’ => ’S’,
    ’&#350;’ => ’S’,
    ’&#348;’ => ’S’,
    ’&#536;’ => ’S’,
    ’&#356;’ => ’T’,
    ’&#354;’ => ’T’,
    ’&#358;’ => ’T’,
    ’&#538;’ => ’T’,
    ’Ù’ => ’U’,
    ’Ù’ => ’U’,
    ’Ú’ => ’U’,
    ’Ú’ => ’U’,
    ’Û’ => ’U’,
    ’Û’ => ’U’,
    ’Ü’ => ’e’,
    ’&#362;’ => ’U’,
    ’Ü’ => ’e’,
    ’&#366;’ => ’U’,
    ’&#368;’ => ’U’,
    ’&#364;’ => ’U’,
    ’&#360;’ => ’U’,
    ’&#370;’ => ’U’,
    ’&#372;’ => ’W’,
    ’&#374;’ => ’Y’,
    ’Ÿ’ => ’Y’,
    ’&#377;’ => ’Z’,
    ’&#379;’ => ’Z’,
    ’Ã ’ => ’a’,
    ’á’ => ’a’,
    ’â’ => ’a’,
    ’ã’ => ’a’,
    ’ä’ => ’e’,
    ’ä’ => ’e’,
    ’Ã¥’ => ’a’,
    ’&#257;’ => ’a’,
    ’&#261;’ => ’a’,
    ’&#259;’ => ’a’,
    ’Ã¥’ => ’a’,
    ’æ’ => ’e’,
    ’ç’ => ’c’,
    ’&#263;’ => ’c’,
    ’&#269;’ => ’c’,
    ’&#265;’ => ’c’,
    ’&#267;’ => ’c’,
    ’&#271;’ => ’d’,
    ’&#273;’ => ’d’,
    ’è’ => ’e’,
    ’é’ => ’e’,
    ’ê’ => ’e’,
    ’ë’ => ’e’,
    ’&#275;’ => ’e’,
    ’&#281;’ => ’e’,
    ’&#283;’ => ’e’,
    ’&#277;’ => ’e’,
    ’&#279;’ => ’e’,
    ’Æ’’ => ’f’,
    ’&#285;’ => ’g’,
    ’&#287;’ => ’g’,
    ’&#289;’ => ’g’,
    ’&#291;’ => ’g’,
    ’&#293;’ => ’h’,
    ’&#295;’ => ’h’,
    ’ì’ => ’i’,
    ’í’ => ’i’,
    ’î’ => ’i’,
    ’ï’ => ’i’,
    ’&#299;’ => ’i’,
    ’&#297;’ => ’i’,
    ’&#301;’ => ’i’,
    ’&#303;’ => ’i’,
    ’&#305;’ => ’i’,
    ’&#307;’ => ’j’,
    ’&#309;’ => ’j’,
    ’&#311;’ => ’k’,
    ’&#312;’ => ’k’,
    ’&#322;’ => ’l’,
    ’&#318;’ => ’l’,
    ’&#314;’ => ’l’,
    ’&#316;’ => ’l’,
    ’&#320;’ => ’l’,
    ’ñ’ => ’n’,
    ’&#324;’ => ’n’,
    ’&#328;’ => ’n’,
    ’&#326;’ => ’n’,
    ’&#329;’ => ’n’,
    ’&#331;’ => ’n’,
    ’ò’ => ’o’,
    ’ó’ => ’o’,
    ’ô’ => ’o’,
    ’õ’ => ’o’,
    ’ö’ => ’e’,
    ’ö’ => ’e’,
    ’ø’ => ’o’,
    ’&#333;’ => ’o’,
    ’&#337;’ => ’o’,
    ’&#335;’ => ’o’,
    ’Å“’ => ’e’,
    ’&#341;’ => ’r’,
    ’&#345;’ => ’r’,
    ’&#343;’ => ’r’,
    ’ù’ => ’u’,
    ’ú’ => ’u’,
    ’û’ => ’u’,
    ’ü’ => ’e’,
    ’&#363;’ => ’u’,
    ’ü’ => ’e’,
    ’&#367;’ => ’u’,
    ’&#369;’ => ’u’,
    ’&#365;’ => ’u’,
    ’&#361;’ => ’u’,
    ’&#371;’ => ’u’,
    ’&#373;’ => ’w’,
    ’ÿ’ => ’y’,
    ’&#375;’ => ’y’,
    ’&#380;’ => ’z’,
    ’&#378;’ => ’z’,
    ’ß’ => ’s’,
    ’&#383;’ => ’s’,
    ’&#913;’ => ’A’,
    ’&#902;’ => ’A’,
    ’&#914;’ => ’B’,
    ’&#915;’ => ’G’,
    ’&#916;’ => ’D’,
    ’&#917;’ => ’E’,
    ’&#904;’ => ’E’,
    ’&#918;’ => ’Z’,
    ’&#919;’ => ’I’,
    ’&#905;’ => ’I’,
    ’&#920;’ => ’TH’,
    ’&#921;’ => ’I’,
    ’&#906;’ => ’I’,
    ’&#938;’ => ’I’,
    ’&#922;’ => ’K’,
    ’&#923;’ => ’L’,
    ’&#924;’ => ’M’,
    ’&#925;’ => ’N’,
    ’&#926;’ => ’KS’,
    ’&#927;’ => ’O’,
    ’&#908;’ => ’O’,
    ’&#928;’ => ’P’,
    ’&#929;’ => ’R’,
    ’&#931;’ => ’S’,
    ’&#932;’ => ’T’,
    ’&#933;’ => ’Y’,
    ’&#910;’ => ’Y’,
    ’&#939;’ => ’Y’,
    ’&#934;’ => ’F’,
    ’&#935;’ => ’X’,
    ’&#936;’ => ’PS’,
    ’&#937;’ => ’O’,
    ’&#911;’ => ’O’,
    ’&#945;’ => ’a’,
    ’&#940;’ => ’a’,
    ’&#946;’ => ’b’,
    ’&#947;’ => ’g’,
    ’&#948;’ => ’d’,
    ’&#949;’ => ’e’,
    ’&#941;’ => ’e’,
    ’&#950;’ => ’z’,
    ’&#951;’ => ’i’,
    ’&#942;’ => ’i’,
    ’&#952;’ => ’th’,
    ’&#953;’ => ’i’,
    ’&#943;’ => ’i’,
    ’&#970;’ => ’i’,
    ’&#912;’ => ’i’,
    ’&#954;’ => ’k’,
    ’&#955;’ => ’l’,
    ’&#956;’ => ’m’,
    ’&#957;’ => ’n’,
    ’&#958;’ => ’ks’,
    ’&#959;’ => ’o’,
    ’&#972;’ => ’o’,
    ’&#960;’ => ’p’,
    ’&#961;’ => ’r’,
    ’&#963;’ => ’s’,
    ’&#964;’ => ’t’,
    ’&#965;’ => ’y’,
    ’&#973;’ => ’y’,
    ’&#971;’ => ’y’,
    ’&#944;’ => ’y’,
    ’&#966;’ => ’f’,
    ’&#967;’ => ’x’,
    ’&#968;’ => ’ps’,
    ’&#969;’ => ’o’,
    ’&#974;’ => ’o’
    );


    $alias_new = strtr($alias_new, $replace_array);
    $alias_new = strtr($alias_new,
    "¿?/ ŠŒŽšœžŸ¥µÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýÿ",
    "----SOZsozYYuAAAAAAACEEEEIIIIDNOOOOOOUUUUYsaaaaaaaceeeeiiiionoooooouuuuyy");
    $alias_new = str_replace(’--’,"-",$alias_new);
    $alias_new = str_replace(’--’,"-",$alias_new);
    $alias_new = str_replace(’--’,"-",$alias_new);
    $alias_new = strtolower($alias_new);

    $fields = array(’alias’ => $alias_new);
    $table = $modx->getFullTableName(’site_content’);

    // Update the database
    $rows_affected = $modx->db->update(
    $fields,
    $table,
    "id = {$e->params[’id’]}"
    );
    //flush_cache();

    // Generate an error if the DB was not updated
    if(!$rows_affected)
    {
    $modx->event->alert("CustomAlias: An error occurred when saving the alias.");
    }





    }

    $e->output(’hello’.$parentID);

    // ?>
      Jabiertxof (formerly XYZVISUAL)
      My bussines: http://marker.es
      https://www.youtube.com/user/jabiertxof/videos
      • 32982
      • 674 Posts
      mejorado....
        Jabiertxof (formerly XYZVISUAL)
        My bussines: http://marker.es
        https://www.youtube.com/user/jabiertxof/videos
        • 1236
        • 33 Posts
        Thanks! I was going nuts because of this error after upgrading to 0.9.6. What’s the basic cause of this? Is there a bug in 0.9.6? Before I upgraded (from 0.9.5) everything worked like a charm. :/
          • 32982
          • 674 Posts
          lucciano in the spanish forum post
          http://modxcms.com/forums/index.php/topic,19302.0.html
          here post you need have the last save_content_procesor.php from SVN
          Its another option...
            Jabiertxof (formerly XYZVISUAL)
            My bussines: http://marker.es
            https://www.youtube.com/user/jabiertxof/videos
            • 1236
            • 33 Posts
            Ok, I took the file from SVN. Thanks again smiley
              • 33337
              • 3,975 Posts
              Any chance if someone ported this to MODX Revolution?
                Zaigham R - MODX Professional | Skype | Email | Twitter

                Digging the interwebs for #MODX gems and bringing it to you. modx.link