We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 19579
    • 51 Posts
    Hi there,

    I recently switched from wordpress to modx for building website. I used to use the page id tag in wordpress to assign images to a page without having to build a seperate template for each page. The images are an important part of the design so adding them through the text editor is not possible.

    For example: Page 1 needs to have the picture of a cow, cow.jpg. I rename the picture to 1.jpg and then add <img src="[page id].jpg"> tot the html.

    I just have to rename the pictures to their corresponding pages. Is there any way to achieve this with ModX or is there even an better solution to my problem?

    Thanks in advance for any help smiley
      • 22427
      • 793 Posts
      You could try it the same way, just the syntax has to be slightly changed: src="page [*id*].jpg" .
      Another possibility is using a TV of type image.
        • 19579
        • 51 Posts
        Thanks! I’m going to try it right away!
          • 19579
          • 51 Posts
          I decided to use:

          <img src="assets/images/[*alias*].jpg" alt="[*pagetitle*]" />


          Because the images get a somewhat more usefull name smiley Works like a charm grin