We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36786 ☆ A M B ☆
    • 209 Posts
    I am trying to convert my page's blog from the Articles system to GridClassKey so I can set the default resource type to that of a MoreGallery "Gallery." My client wants the ability to use the MoreGallery functions on all blog posts. I also personally like the flexibility of GridClassKey. I don't use tags.

    The problem I am having is that I do not know how to reproduce the friendly url alias used for Articles posts.
    %Y/%m/%d/%alias/

    If this wasn't a problem I would simply using batcher to move the resources over.

    Does anyone know how I could go about reproducing these auto-generated aliases? I would prefer to use GridClassKey but if I could change the default child type of Articles, and it were simpler to do so, I am certainly open to it as an alternative.

    Thanks!
      Ben Morrison
      Hacking templates to pieces since 2003
      • 30585
      • 833 Posts
      I haven't tried it myself, but I think this extra may be helpful: CustomUrls

      You could then use this pattern:
      [[+publishedon:strtotime:date=`%Y/%m/%d`]]/[[+alias]


      EDIT: replaced "-" with "/" [ed. note: treigh last edited this post 12 years, 6 months ago.]
        A MODx Fanatic
        • 36786 ☆ A M B ☆
        • 209 Posts
        Yes I JUST found that 2 minutes ago, hopefully it will work. I did put an feature request on Github for GridClassKey requesting a function for child URL patterns.
          Ben Morrison
          Hacking templates to pieces since 2003
          • 30585
          • 833 Posts
          Glad you sorted it out.

          It'd definitely make sense to have a built-in custom URL functionality in GridClassKey.
            A MODx Fanatic
            • 36786 ☆ A M B ☆
            • 209 Posts
            Now when I tried to move some article's from the Articles extra into the GCK container I get the following when I try to edit it:
            Fatal error: Call to undefined method GridContainer_mysql::getContainerSettings() in /home/ties/public_html/core/components/articles/model/articles/article.class.php on line 76


            I am guessing that is because the resource type is still set to whatever custom one Articles uses and that is interfering somehow (should have expected that). Do you know a way to change resource types in bulk? Batcher does not do that and I am not great at all with going into the MySQL directly.
              Ben Morrison
              Hacking templates to pieces since 2003
              • 30585
              • 833 Posts
              I bet that this has to do with the class key used. Articles uses 'Article' for it resources. I'm not sure what GridClassKey uses, but I'd look here first.

              As far as batch-updating, I'd use PHPMyAdmin to update the class_key column of the modx_site_content table. It's the fastest method I know.
                A MODx Fanatic
                • 36786 ☆ A M B ☆
                • 209 Posts
                Thanks, I will have to take a look at that
                  Ben Morrison
                  Hacking templates to pieces since 2003
                  • 30585
                  • 833 Posts
                  It's what I thought, GridClassKey uses modDocument for it's class_key. Just update this table column from Article to modDocument
                    A MODx Fanatic
                    • 36786 ☆ A M B ☆
                    • 209 Posts
                    Thanks! Now if only I could get createdby to be a field in a standard resource type it would be perfect, but I suppose I will have to live with that for now.
                      Ben Morrison
                      Hacking templates to pieces since 2003
                      • 30585
                      • 833 Posts
                      I hear you. I tried playing around with Form customization and GridClassKey's content settings, but no luck there. No apparent way to add a createdby field.
                        A MODx Fanatic