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

    Let's say I have a page. This page has a first paragraph as introduction which would be "content" tag
    Then it has 2 other blocks with more text. How do I handle this so that the user can edit each block seperatly ?
    Many thanks
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      That's what TVs (Template Variables) are for.
        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
        • 24017
        • 88 Posts
        Humm .. still a bit confused ....does that mean I have to have as many templates as content blocks, and if I make any change to the main template structure I have to go modifying every single template ?


        Let's say I have my home page with main content , and 2 template variables called "rightboxtext" and "leftboxtext"
        If i create another page based on the main template I still have those template variables showing, but those template variables are only for the homepage because every other page has a different layout. From what you are telling me I would need to have every page with the same layout .... the question would be , can we assign a template variable to a specific page ?
        Hope it is clear enough smiley
        Many thanks
          • 12491
          • 90 Posts
          There are many ways to go Modx:

          two of them:

          use tv's to set the chuncks that make up the layout and content of a resource. (chunck parser)

          use a template for each page layout made off layout html elements (chuncks) and use extra tv's for the page specific extra content elements like images, prices, tags, etc

          handy:
          tv's are easy to group by category an you can make them applicable for specific user roles.
          so you for example can set layout tv vars , client the content related ones.

          Just go and play with modx and you will see the greatness of it. It's al up to you how you wan't it.

          Before starting in modx save yourself some time and follow some tutorials to get you started, there are many.
          you need to grasp these elements

          template/chunck/snippet/tv/getresource/getpage/tpl's


          before building so you can choose the right way of making you web-thing , thing because with mentiond elements and other beautifull stuff in Modx you can make everything you can think of.


          Grtz Hurby


            Sommige mensen hebben aan een half woord genoeg
            • 24017
            • 88 Posts
            Thanks a lot for this reply ... I am really impressed with modx really and tell you that I am playing around with it a lot ... the issue is I am thinking of using it for my clients and still trying to see how I can do that .... for instance from what I understand, chunks are very good , but they are raw html, so there is no easy way for a client to modify the content placed in a chunk ... I'm just like any other designer , trying to design the thing and set up content so that it can all be edited by a user ... and I am getting a bit confused between chunks and tvs ....

            I really do appreciate the effort you make trying to explain but to be honest for a newbie like me most of the things you say like "use tv's to set the chuncks that make up the layout and content of a resource. (chunck parser)" are still pretty abstract, I just do not understand at all what it means !! smiley

            Now is it possible to apply a TV to a specific document ? I guess that will answer my main issue ?

            Many thanks
              • 12491
              • 90 Posts
              lets say you want a pagelayout for home, one for pages, one for contact, one for portfolio.

              make 4 templates.
              Elements that you want in all pagetypes become chuncks. for example a top menu, a head
              use the standard things like content, title, introtext, longtitle etc in youre templates and chuncks

              Inside these chuncks and templates you place tv's where you want editable and page specific values, like metatags for example.

              a tv can be almost anything a video, a value a date, number etc.

              So: a head chunck for all templates with in there a tv for metatags and the standard title var. (let's say standard vars are standaard tv's allready there....)

              tv's come in different kinds so yo can ouput everything you want anywhere you want and even make you own, but forget that for now.

              hope this helps a bit more in understanding the difference , i,m dutch so excuse my english grammar

              some people get confused by the name of chuncks in getresource calls for example "tpl"
              tpl and chunck are the same things basicly, a bit confusing, plugin;s and snippets ask for tpl's (= chuncks...) to output the data in the way you want.

              So combine css and chuncks to make templates for needed page variants (layout)
              set resources to the desired page template.
              set tv value's like: text, metatags,images, etc for the resource.

              and if i really suck in explaning dont't give up!

              you may set tv value's in each resource so : yes you can *-)

              grtz
              Hurby
              [ed. note: hurby last edited this post 15 years, 2 months ago.]
                Sommige mensen hebben aan een half woord genoeg
                • 24017
                • 88 Posts
                Hihi ! No problem at all ... first of all I' french so my english can also sometimes be restricted and not as clear as I'd like it to be , second, there is no way i would complain about someone trying its best to help !!!! I actually thank you for your patience.... Now I think I did understand all those concept better ... the main concern I have is how do we adapt all this for a customer .... I mean my main problem is not that much about learning how to set up chunks or tvs .... I know I will have to spend more time to discover all this .... Right now I've just started to test the basic ... putting a template together and see how to manage the content and see if I can use it for clients ... What I'm trying to work out is if I can use this system to:

                Create pages and provide customers with a straightforward panel ... they login , they have the menu on the left that says "homepage / introduction text / left box text / rightbox text" - "Page2 / main text/ banner right text" / - "Page3 / main text/ banner right text / imagebottom" etc etc ......

                My main issue is (I might be a bit dumb as well hihi!!) so far I worked out the template thing, I have my homepage , with its content and 2 template variables for 2 other content blocks ... all fine ... what I can't work out now is .... if I create one more page based on the main template , It still contains the 2 template variables used in the homepage ..... I do not want those variables anymore as they are blocks designed only only to go on the homepage, the other page should not show those variables anymore but others ..... is that possible ?

                Many thanks for your help!!
                  • 22427
                  • 793 Posts
                  the question would be , can we assign a template variable to a specific page ?
                  Not to a specific page, but to a specific template.
                  Like hurby already said: Just use different templates, a special one for the home page. Assign the TVs leftboxtext and rightboxtext only to this special template and not to the others.
                    • 24017
                    • 88 Posts
                    I guess that wil be the easiest ! Many thanks to all for your help.