We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 40141
    • 1 Posts
    Hi guys! So my client requested that we use modx for the project, and I'm a total noob about it. I've been diggin through the documentation, it kinda makes sense where you can use tags to template pretty much anything, and I really like it.


    Template Variables

    Alas, I'm utterly confused by the concept of TVs and resource management. Let me continue with an example here. So we have this testimonials page, and my client wants to be able to enter more items on that list. Each item will consist of an image, the testimonial and a name.

    How would I add this functionality into modx? Right now, I'm thinking about creating a template for testimonials, 3 TVs for the data, (relevant question: can one tv hold more than one input option? can't see anything about that under the input options tab) and a resource for each item on the list. So when the client wants to enter a new testimonial he'll just create a new resource under the testimonials folder. Then I'll just call the getResources plugin in the main template to print them into the page.

    Does this make any sense? Or am I completely off track here?


    Resource Management

    I'm thinking about having a folder called pages, and list the pages under there. and also a folder for each data entry point. IE. I'll have folder named testimonials and the client will create new data by creating a resource under there. Same for features and etc.

    Is this the way to go here? He granted me access to one of his older projects and the whole thing was a mess, I couldn't even understand how they used the resources, so I wanted to make it easier for both of us by creating such a resource structure.

    Is there a better practice? If so, how?


    An easier way for if statements

    Situation: We have some content right under the navigation. It's a big bold text with some images and marketing text on the homepage, and the name of the current page for the rest of the pages.
    I installed the If snipplet, but I'm not sure if it can hold html code as the "then" condition. So I'm thinking about creating a chunk out of that bit in the main page and calling it for the "then", and calling the page title tag for the "else". Sadly, that bit on the homepage is pretty much the main selling point and I'm sure he'll be testing it a lot. So going into the chunk to change that seemed a bit needlesly difficult.

    Can the "then" condition hold html? (What would be the correct syntax for that?) Or is there an other way to do it from the resource itself?


    CSS Sprites

    Again, from the testimonials page example: We'll probably have 10-15 small thumbnails in there, which will surely effect the load times quite a bit unless it's in a sprite. Since my client will be updating this regularly, is there way to do it by grabbing them from TVs, creating the sprite and then outputting it in an automated fashion? This one is obviously not that crucial, but it's a good practice and I wanna do it, so any suggestions on this are most welcome.


    Thank you!
      • 19369
      • 1,098 Posts
      Quote from: tatarjr at Jun 13, 2012, 05:53 PM
      I'm thinking about creating a template for testimonials, 3 TVs for the data, (relevant question: can one tv hold more than one input option? can't see anything about that under the input options tab) and a resource for each item on the list. So when the client wants to enter a new testimonial he'll just create a new resource under the testimonials folder. Then I'll just call the getResources plugin in the main template to print them into the page.

      Does this make any sense? Or am I completely off track here?
      I think you're doing it right.

      If you want you can also add new testimonials without adding resources (unless you have to do so, for example for SEO purposes). There is an addon that allows you to add multiple values into one TV, see here: http://rtfm.modx.com/display/ADDON/MIGX

      An easier way for if statements

      Situation: We have some content right under the navigation. It's a big bold text with some images and marketing text on the homepage, and the name of the current page for the rest of the pages.
      I installed the If snipplet, but I'm not sure if it can hold html code as the "then" condition. So I'm thinking about creating a chunk out of that bit in the main page and calling it for the "then", and calling the page title tag for the "else". Sadly, that bit on the homepage is pretty much the main selling point and I'm sure he'll be testing it a lot. So going into the chunk to change that seemed a bit needlesly difficult.

      Can the "then" condition hold html? (What would be the correct syntax for that?) Or is there an other way to do it from the resource itself?

      If the content inside &then=`` parameter does not contain the backtick character it should work fine. You can try with this code:
      [[If? 
           &subject=`[[*id]]` 
           &operator=`=` 
           &operand=`ID_FOR_HOME_PAGE_RESOURCE_HERE` 
           &then=`Content_for_home_page` 
           &else=`Content_for_other_pages`
      ]]


      So if you are in the home page, it will use the &then parameter, if you are in another page it will output the &else parameter.
        • 19369
        • 1,098 Posts
        Resource Management
        I'm thinking about having a folder called pages, and list the pages under there. and also a folder for each data entry point. IE. I'll have folder named testimonials and the client will create new data by creating a resource under there. Same for features and etc.

        Is this the way to go here?
        Yes! You have understood a lot of things considering that you're new to MODX!