We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 39932
    • 483 Posts
    @Antsplace:

    You create a single Template called Alias (Template). Then you create one Resource and place it under any Resource of the Template you want to "extend". You can do this for as many "actions" you want.

    Here's an example:

    I have 2000 Products. I want a "buy" link to be added to all Products. I make one Resource of Alias (Template) and put it under any single Product (doesn't matter which one). Now all of my Products can be bought with the URL -- http.://path/to/Product/buy

    Further, if I wanted to "sell" them all, I would make another Resource of Alias (Template) named "sell" and place it under any single Product (preferrably the same one). Now, they all can be sold in the same manner.

    For your purposes, you would create one Resource for every Template you want to "extend", so 12 total (if they are all extended). Inside each, you have a snippet that grabs the content of the "fake parent" which is passed to the Alias. Then you just $output it.

    Seriously, just follow this tutorial. It's an eye-opener. It only takes about 10 minutes to do. It takes longer to read than it does to implement. And it takes very little time to remove. 1 Plugin, and however many resources you created during the tutorial.

    And if you need to, don't hesitate to call on my assistance. Send me a PM or EMail with my profile and I'll get in touch as soon as possible. [ed. note: fuzzicallogic last edited this post 11 years, 8 months ago.]
      Website: Extended Dialog Development Blog: on Extended Dialog
      Add-ons: AJAX Revolution, RO.IDEs Editor & Framework (in works) Utilities: Plugin Compatibility List
      Tutorials: Create Cross-Context Resources, Cross-Context AJAX Login, Template-Based Actions, Remove Extensions from URLs

      Failure is just another word for saying you didn't want to try. "It can't be done" means "I don't know how".
      • 1841
      • 141 Posts
      Thanks fuzzicallogic, much appreciated. I'll give it a try.
        • 1841
        • 141 Posts
        Ok I've gone through the tutorial but can't get this to work at all, I don't fancy turning on "friendly alias path" as this will change many of the two thousand or so pages I've got and i'd rather not use the system than even think of the problems this would cause.

        I did however try the fix "avoiding extension and slash issues" however all this changes is that the original url still loads if I add something else to the end. This could prove problematic as far as seo goes as it could potentially create a but duplicate content issue. If the wrong url is entered then a 404 is the most effective response really.

        Not sure if it would make a difference but as I didn't choose to enable friendly alias path I did change my folder extensions to .htm

        Just to see if these were the issue I enabled full alias and changed the container suffix to / and it still doesn't work:

        This is the test resource:

        http://searchenginesandbox.co.uk/about-science-fiction-books/sci-fi-books/science-fiction-authors/dan-abnett1/embedded/test-action.htm

        and this is a resource using the same template:

        http://searchenginesandbox.co.uk/about-science-fiction-books/sci-fi-books/science-fiction-authors/dan-abnett1/gaunts-ghosts-series/ghostmaker/test-action.htm

        You can probably see why I'd rather not use full alias path, I use folders as an effective method of organisation of the pages.

        I do however use the articles plugin but changed priority of the "onpagenotfound" of that to 4, it didn't seem to help. [ed. note: antsplace last edited this post 11 years, 8 months ago.]
          • 39932
          • 483 Posts
          @antsplace:

          There was another gentleman who also did not have FURLs, but he actually wanted FURLs. I may be able to adjust everything for non-FURLs, but it will take a couple of days. All that would have to be done is check the $_GET params if FURLs is not on. This will be fairly easy.

          This would actually be a different technique, but still ultimately the same result. Basically, you will use index.php?id=XX where XX is your mobile "template" and add &for=XX where this would be the original ID. You can get rid of that plugin. It will not help you without FURLs. In fact, you won't even need a Plugin (unless you use one for mobile detection). Just the Snippet for the mobile page.

          Then in your "mobile" detector, you would just adjust the URL to meet the above format, and sendForward to the mobile resource.

          Are you able to wait for a day or so?

          Note: Your MODx seems to be affected by the bug that is present in some versions. The reason why it is not working is the System Setting is not returning the Template Type correctly. This is mentioned in the tutorial. You may alleviate this may changing it to a number with the value of the id of the template Alias (Template). However, if you don't want FURLs I would just wait a day or two. Then you won't have to worry about it.
          [ed. note: fuzzicallogic last edited this post 11 years, 8 months ago.]
            Website: Extended Dialog Development Blog: on Extended Dialog
            Add-ons: AJAX Revolution, RO.IDEs Editor & Framework (in works) Utilities: Plugin Compatibility List
            Tutorials: Create Cross-Context Resources, Cross-Context AJAX Login, Template-Based Actions, Remove Extensions from URLs

            Failure is just another word for saying you didn't want to try. "It can't be done" means "I don't know how".
            • 1841
            • 141 Posts
            Hi,

            Sorry I think there must have been confusion with last message. I do want to use friendly urls, just not full path alias, as you can see they get a bit long.

            I use just flat urls, but they aee friendly urls.

            I'll give the template id a try, it wss showing the id number when i selected though. I am using the latest modx version (2.24) if thst helps.
              • 39932
              • 483 Posts
              @antsplace:

              I do want to use friendly urls, just not full path alias, as you can see they get a bit long.

              I'm sorry I misunderstood. Let me address this:

              Template Aliases/Subpages/Extensions (they're all the same) must use the full path. That's how it knows which "Parent" to apply it to. If you would like a different scheme, I can do this custom, but you'll have to tell me what the URL scheme is. In other words, I can't realias the "parent"... That would screw with your site.

              I have several other aliasing scripts that might fit the bill (I've worked on the topic of aliasing a lot). For instance, I have one where you could have the page URL be: http.://domain.tld/mobile/#. The # would be the id of the resource. (It would be a slight mod of my AJAX plugin, you would change the "ajax path" System Setting to "mobile".)

              I'll give the template id a try, it wss showing the id number when i selected though.

              Yup. It does that. For some reason, it looks like it is working, but really isn't. This took about 1/2 an hour to debug on @sottwell's installation. The Template Type works correctly on my installation, but not on hers. Both were 2.2.4. I'm still not sure what or when this occurs, but I'm looking into it. I believe it has to do with the fact that on my installation it was a Number first and after it was working I switched it to a Template. I have no absolutes though. I'll be trying to replicate the problem on my Cloud. [ed. note: fuzzicallogic last edited this post 11 years, 8 months ago.]
                Website: Extended Dialog Development Blog: on Extended Dialog
                Add-ons: AJAX Revolution, RO.IDEs Editor & Framework (in works) Utilities: Plugin Compatibility List
                Tutorials: Create Cross-Context Resources, Cross-Context AJAX Login, Template-Based Actions, Remove Extensions from URLs

                Failure is just another word for saying you didn't want to try. "It can't be done" means "I don't know how".
                • 1841
                • 141 Posts
                I tried changing the "id_template_action" to the template number instead and it didn't seem to make a difference, still get 404's on the pages I tried it on.

                URL scheme wise I am not too fussed, I guess ideally one that would be easy to redirect users to via any detection script I use (I am planning on using htaccess) so perhaps ?=mobile appended at the end of a url?
                • You know, the alias is actually passed to MODx via the rewrite rules (?q=alias.suffix)

                  So it might be more flexible if you used the GET, and if there's the q= you know it's an alias, and if you have id= and it's a number you know you have an ID.
                    Studying MODX in the desert - http://sottwell.com
                    Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                    Join the Slack Community - http://modx.org
                    • 1841
                    • 141 Posts
                    Hi Susan, thanks for the input, forgive me but I'm not sure I understand?
                    • Oops... the forum didn't like my text.

                      The rewrite rules replace the page.html part of the URI with a call to index.php, appending the part after the domain as a query string.

                      So it might be more flexible if you used the GET, and if there is a
                      ?q=something
                      key/value, you know it's an alias, and if you have
                      ?id=xxx

                      and it's a number you know you have an ID.
                        Studying MODX in the desert - http://sottwell.com
                        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                        Join the Slack Community - http://modx.org