We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 52609
    • 32 Posts
    I have created a template that is the "frame" for each of my pages (top and side menus).
    The call to the CSS files is in the template (in <head>).

    I have created a webpage resource with this template: page1 (1).
    This is my homepage: page1.com.
    The "content" is the material that goes inside the frame, which differs from page to page.
    CSS looks fine (both for the frame and for the content).

    I have created another webpage resource with this same template: page2 (2).
    If I "view" this page, I see page1.com/page2.html as the URL and the CSS looks correct.

    If, however, I put a link in page1 to page2, the CSS does not look correct for page2 content when the link in page1 is clicked.
    The html for the link is in the page1 content and it looks like this: <a href="[[~2]]">text</a>.
    When clicked, I am taken to page2 content (within the frame created by the template), however the CSS for the content is off and the URL still reads page1.com. (Though, hovering over that link shows page1.com/page2.html)

    If the link to page2 is put in the template, I am taken to page1.com/page2.html and the CSS is fine.

    What's going on here?
    Does any page that will have links in the content have to be a new template?
    If so, then all my pages will have to have their own template which makes the template/webpage resource difference moot.
    What am I missing?

    Thanks in advance for any insight!
      • 28432
      • 372 Posts
      Have you got
      <base href="[[!++site_url]]" />
      tag in your template head (<head>) ?

      I think page1.com it's not correct, it's more like, page 1 is replaced by domainname.com
      So page 2 looks like this domainname.com/page2.html

      This [[~2]] is the correct code to link to page with ID 2

      Does any page that will have links in the content have to be a new template?
      No! Fortunately not...
        • 38783
        • 571 Posts
        You mention "frame" when describing how your pages/templates work. Is this purely for the purpose of describing the structure to us, or have you actually used the html tag <frameset> to define the location of page 2 within a frame on page 1?
          If I help you out on these forums I would be very grateful if you would consider rating me on Trustpilot: https://uk.trustpilot.com/review/andytough.com

          email: [email protected] | website: https://andytough.com
          • 52609
          • 32 Posts
          Thanks for your reply Steeve!

          Quote from: Steeve at Aug 16, 2016, 07:49 AM
          Have you got
          <base href="[[!++site_url]]">
          tag in your template head () ?

          I did not have this -- I added it to my template <head> and that didn't solve the problem.

          Quote from: Steeve at Aug 16, 2016, 07:49 AM
          I think page1.com it's not correct, it's more like, page 1 is replaced by domainname.com
          So page 2 looks like this domainname.com/page2.html

          This is true! I named page1=domainname to reduce confusion on my own part.

          Quote from: Steeve at Aug 16, 2016, 07:49 AM
          This [[~2]] is the correct code to link to page with ID 2

          And yet, page2 (with page ID 2) still does not show with proper CSS - only when linked from content of a page resource, not when linked from the template element!

          Still trying to figure out what I'm missing!
          Thanks,
          ~Julie

          [ed. note: juliehoy last edited this post 7 years, 8 months ago.]
            • 28432
            • 372 Posts
            Quote from: juliehoy at Aug 16, 2016, 03:42 PM
            And yet, page2 (with page ID 2) still does not show with proper CSS - only when linked from content of a page resource, not when linked from the template element!

            Are you using a rich text editor (RTE) for content field ? If yes, can you copy and past the code here ?
            You can find the code HTML generated by the RTE after clicking on the HTML button from the RTE.
              • 52609
              • 32 Posts
              Quote from: andytough at Aug 16, 2016, 12:27 PM
              You mention "frame" when describing how your pages/templates work. Is this purely for the purpose of describing the structure to us, or have you actually used the html tag to define the location of page 2 within a frame on page 1?

              Thanks for your reply Andy!

              I was using "frame" colloquially - I did not use the html tag <frameset>.

              My template contains the <head> and <header>. The <header> has a menu across the left side and across the top that stay the same and "frame" the "content" -- which would be the html that I put in the Content section of the Webpage Resource using this template.

              If I put a link to a page ( <a href="[[~2]]">text</a>) in the template, that page opens and displays with the proper CSS.

              If I put the same link in the content of another page, the requested page opens without the proper CSS.

              The above problem is true of any pages. I tried it with several pages just to make sure that it wasn't a problem with one particular page.

                • 52609
                • 32 Posts
                Quote from: Steeve at Aug 16, 2016, 03:48 PM

                Are you using a rich text editor (RTE) for content field ? If yes, can you copy and past the code here ?
                You can find the code HTML generated by the RTE after clicking on the HTML button from the RTE.


                Hi Steeve, no I'm using the MODX Manager, where you put in the HTML directly.

                Code is attached. I pasted it into a Notepad .txt document called "ProblemCode". [ed. note: juliehoy last edited this post 7 years, 8 months ago.]
                  • 52609
                  • 32 Posts
                  Oops, somehow that doc first loaded empty. I have put the correct doc as an attachment.
                  The little "X" doesn't make the first doc go away so I can't delete it.
                  Thanks!
                    • 38783
                    • 571 Posts
                    Hello Julie,

                    The attachment seems to be empty. Would you mind posting the code from the template? Is the same template used for both pages? If not could you post both?

                    I thought it unlikely that you would have used <frameset>but thought I had better ask!

                    It would also be useful to know what your FURL settings are in the Manager and whether you are using an .htaccess file.
                      If I help you out on these forums I would be very grateful if you would consider rating me on Trustpilot: https://uk.trustpilot.com/review/andytough.com

                      email: [email protected] | website: https://andytough.com
                      • 28432
                      • 372 Posts
                      I did not have this -- I added it to my template <head> and that didn't solve the problem.
                      Keep it ! You will need this if you use rewrite URL with alias path ;-)

                      Have you try to call the MODX content tag uncached ?
                      [[!*content]]