We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 2960
    • 16 Posts
    Hi guys,
    tanks for your help.... now it works.... at the moment I realy don’t know why, but it works. And now go on to study Modx.

    Special tanks to Sosa for the patience.
      • 7231
      • 4,205 Posts
      When using an editor page (&editorpageid) how do you get the "Cancel" button or a cancel link go back to the original document? I tried this [~[+fdmid+]~] but it did not work as expected. It would be nice to be able to make the cancel button adhere to the &redirect parameter or have a redirect placeholder (is there a redirect placeholder?).
        [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

        Something is happening here, but you don't know what it is.
        Do you, Mr. Jones? - [bob dylan]
        • 10534
        • 40 Posts
        Is there a way to use auto increment for the menu-index ? I’ve been trying some things in fdm.class.inc.php (for example: $fields[’menu_index’]=$modx->db->getInsertId(); ), but to no avail...
        In the preferences the auto increment is enabled and when I add a new page to the container where the doc has to go to the menu-index gets incremented correctly..

        Any ideas?

        EDIT: got a fix for it, see code
        //menu-index autoincrement
        $fdmpid = intval($_SESSION['fdm']['parent']);
        $tbl = $modx->getFullTableName("site_content");
        $sql = "SELECT count(*) as 'cnt' FROM $tbl WHERE parent='$fdmpid'";
        $fields["menuindex"] = $modx->db->getValue($sql);


        Put this in fdm.class.inc.php, somewhere in function fillDoc(&$fields) and you’ll have the menu-index autoincremented
          • 27889
          • 415 Posts
          @gavro, FDM is not based on the manager api, that’s while you don’t need to be logged in the manager to edit the docs. Currently there is no way to auto increment the menu-index, but I can add this to the Todo list.
          The only way (I think) to do this is to retrieve the last index in the table and then increment and save it to the new doc.
            MODx Sites & Prestations: http://dp-site.fr [Last MODx Site]
            MODx Repository: [HOME] [MetaTagsExtra] / Current Dev: [xFDM]
            • 10534
            • 40 Posts
            You are right... see my adit above for a quick hack wink

            ---
            //menu-index autoincrement
            $fdmpid = intval($_SESSION['fdm']['parent']);
            $tbl = $modx->getFullTableName("site_content");
            $sql = "SELECT count(*) as 'cnt' FROM $tbl WHERE parent='$fdmpid'";
            $fields["menuindex"] = $modx->db->getValue($sql);


            Put this in fdm.class.inc.php, somewhere in function fillDoc(&$fields) and you’ll have the menu-index autoincremented
              • 27889
              • 415 Posts
              @gavro, thank you for the tips, I will add it in the next release.
              @dev_cw, sorry, I miss your post, editorpageid is not fully tested for the moment and I will add in FDM more placeholder to allow users more free.
                MODx Sites & Prestations: http://dp-site.fr [Last MODx Site]
                MODx Repository: [HOME] [MetaTagsExtra] / Current Dev: [xFDM]
                • 23050
                • 1,842 Posts
                Hi Soda smiley

                I would like to change the _ in alias but don’t find where ... I would prefer to have - instead. Can you point me where I can change that ?

                Thanks for your help wink
                  • 27889
                  • 415 Posts
                  Hello Perrine,
                  Some people prefer to have "-" insteed "_" but google team say that it is processed the same, I will put this as an option in the next release.
                  You can hack this behavior in fdm.db.class.php arround line 236:
                  change:
                  $alias = preg_replace('/\s+/', '_', $alias);
                  $alias = preg_replace('|-+|', '_', $alias);
                  $alias = trim($alias, '_');
                  

                  width:
                  $alias = preg_replace('/\s+/', '-', $alias);
                  $alias = preg_replace('|_+|', '-', $alias);
                  $alias = trim($alias, '-');
                  
                    MODx Sites & Prestations: http://dp-site.fr [Last MODx Site]
                    MODx Repository: [HOME] [MetaTagsExtra] / Current Dev: [xFDM]
                    • 23050
                    • 1,842 Posts
                    Hi Soda and thank you ! smiley

                    Google team says that but some people have made some tests and it seems that it’s not exactly the same ! smiley And, personnaly, I prefer - than _ ... not question of SEO, but reading smiley
                      • 23050
                      • 1,842 Posts
                      I changed &aliastype to %D% ... but, in my form, I don’t ask user to choose a date... so publish date is null and I get this error when validating :

                      PHP error debug
                        Error: 	strftime() expects parameter 2 to be long, string given	 
                        Error type/ Nr.: 	Warning - 2	 
                        File: 	/xxx/assets/snippets/FDM/includes/fdm.class.inc.php	 
                        Line: 	330	 
                        Line 330 source: 	$val=strftime ( $rest ,$datefield);


                      I know... I test strange things ! grin

                      Edit : Doesn’t work, even with &aliasdate=`createdon` (didn’t see this parameter before)