We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 50335
    • 4 Posts
    Hello.

    I have a situation like this: . This is my mobile homepage template and it has a few different pages. Once I click on one of them, I want to be redirected to another page: .

    I have a simple HTML/CSS/JS mobile template and what I have done up at this point is imported everything into my root modx folder and created a Home template. Now I want to create additional pages for those button from the home page. I'm trying to go to Resources > New Document and create a new page this way, but then I'm creating it and setting a template to my new imported one (named "Home Template)", it just opens up my home template but not the page I have created. What am I doing wrong? Thank you.
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      You need to have the URL point to the desired resource; usually using a MODX link tag like [[~2]] to point to resource #2. If you have "friendly URLs" enabled, so that you can use domain.com/page.html, you also need to have a server rewrite, if Apache a set of .htaccess mod_rewrite rules, or if nginx the appropriate rewrite directives in its configuration file.

      A common reason for having the 'home' page display when you are expecting something else is that you have the MODX 'page not found' error_page system setting set to redirect to resource #1 (usually the home page). You should always create a dedicated 'not-found' resource, and change the system setting to that resource ID#, just so you can clearly see what is going on.
        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
        • 50335
        • 4 Posts
        Hi and thank you for quick response.

        Whatever I do, it just doesn't find my page.

        Here, I'm creating a page named "Sports" with ID of 4:


        Then I'm referencing this ID inside my Home Template (which has all the buttons):
        and what I got is redirect to the home template (or 404 Not Found).

        EDIT: I did a little test and created a WebLink (instead of a document) and it worked. It got redirected to external link from my page with the same technique I'm using. But it doesn't work with a document. It shows in the address bar that I'm referencing Sports index.php?id=4, but it doesn't show my page content.

        EDIT 2: When I change a template from my home template to the base template, it shows up the content without any problems (then I click on the SPORTS button/link, it's being redirected to the actual content). [ed. note: diamond007 last edited this post 11 years, 5 months ago.]
          • 4172
          • 5,888 Posts
          do you have

          <base href="[[++site_url]]">


          in the head?
            -------------------------------

            you can buy me a beer, if you like MIGX

            http://webcmsolutions.de/migx.html

            Thanks!
            • 50335
            • 4 Posts
            No, I didn't have this. I added to my head chunk file, but it's the same - when I press on one of the buttons in the home page, I get the same home page. I have created a 404 page and it works fine then I am trying to write "whatever" in by address bar (I get that error), but with those buttons it's still being redirected to the home page template.

            One way I managed to create a page (with good redirection) is with a brand new template for that page and in the content area I wrote HTML static code for that page. But it's not a good thing (I think) to have different templates for all the pages I have in my mobile website.

            I'm probably missing something, but I have went through a lot of tutorials online for creating documents (pages) with ModX, and I just don't know why I cannot do this simple thing.

            Breakthrough of what I did:

            1. Created a new HOME TEMPLATE which has HTML/CSS/JS code of my mobile template homepage.
            2. Created a chunk to store my header data.
            3. Created a page SPORTS, set template to my HOME TEMPLATE, set resource alias to SPORTS.
            4. Added <base href="[[++site_url]]"> to my HEAD tag.

              • 4172
              • 5,888 Posts
              what is the content of your template and head-chunk now?
                -------------------------------

                you can buy me a beer, if you like MIGX

                http://webcmsolutions.de/migx.html

                Thanks!
                • 28042 ☆ A M B ☆
                • 24,524 Posts
                How do you have Friendly URLs configured?
                  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