We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
  • But yes, you will be able to use the alias cleansing function to turn any string into a proper URL slug.
      • 45682
      • 1 Posts
      I know it's an old thread but if anyone is still looking for a code example here it is.

      $resource = $modx->newObject('modResource');
      
      // set some fields...
      $resource->fromArray($someFields);
      
      // modResource::cleanAlias 
      // Transform a string into a valid URL representation
      $alias = $resource->cleanAlias('My dirty URL_alias');
      
      $resource->set('alias', $alias);
      
      $resource->save();
      
        • 44659
        • 20 Posts
        Quote from: ianbrind at May 15, 2014, 03:19 PM
        I know it's an old thread but if anyone is still looking for a code example here it is.

        I know it's an old thread too, but i need to thank You for your answer, because now i can simplify some stuff smiley