We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 20245
    • 2 Posts
    When using Ditto 2 to generate news I would like to set pub_date in document alias, so that document alias is
       [color=red]yyyy.month.day-time[/color] 
    for all news articles. How to do that? Is there a good way to set document alias to
       [color=red]yyyy.month.day.time-sometext[/color] 
    for selected article where sometext is some specific text (initial value of document alias, for example)?

      • 23491 ☆ A M B ☆
      • 1,056 Posts
      Check for the "CustomAlias" plugin (v0.96) in the repository. It can do exactly what you need.
        Mike Reid - www.pixelchutes.com
        MODx Ambassador / Contributor
        [Module] MultiMedia Manager / [Module] SiteSearch / [Snippet] DocPassword / [Plugin] EditArea / We support FoxyCart
        ________________________________
        Where every pixel matters.
        • 20245
        • 2 Posts
        Exactly, thank You!

        But there’s a problem with dates. This code in CustomAlias

        // 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;
        }
        


        returns incorrect dates in $_POST[’pub_date’] and $_POST[’createdon’]. With
        $published = '';
        $created = '';
        

        It works perfectly. I just need to get pub_date in alias. Any solution?