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

    I would like to add a chunk to some pages but need a TV within it. My first thoughts were to use a TV referencing a document that uses another templete with just additional HTML needed, and this would have a TV embedded that could be used to add the page specific content. However when I call the document, its template is not called with it. I know, I could always add the HTML around the content within the document (and drop the template idea), but I was looking for tidier solution. Another solution would be have a second template with the addition HTML needed and set up a TV within that, but two templates mean two templates to maintain. Is there a simple solution I’m missing? If not, I guess I will just use a second, alternatve, template for the pages that need the extra content.
      • 7231
      • 4,205 Posts
      No sure if I understood. But my recommendation would be to use a conditional statement (either a snippet or with PHx) to load the chunk with the additional html when needed.

      As for putting a TV in a chunk, this should work I do it all the time. If it is not parsing, then change the snippet call to uncached [!snippet!] rather than cached [[snippet]].
        [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

        Something is happening here, but you don't know what it is.
        Do you, Mr. Jones? - [bob dylan]
        • 23562
        • 57 Posts
        @ Colin

        yeah I did that thing with additional template, when I needed flash player ( when I embed it myself ) so basically I had two templates, one basic one, for all pages, and the same modified template with flash player( to use only for page where its needed, you can call it extra content ;-) ), ’am still a bit confused on how to use TV’s for this kind of stuff so I can stick just to one template...

        @All

        Now I came into situation where I need different images for each page, situation is : for each page, I have different
        image that represents the page you’re currently on, example : when you’re on contact us page you have contact us img. and so on, about us..etc...

        I’ve been thinking about this, and I found out that ’am still a bit confused about how this could be achieved in modx and not using separate template with just that additional content, I suppose it can be done with TV’s but ’am just confused...

        Any hint/help in solving this would be great!

        Thanks for reading! ;-)

        Igor
          • 4310
          • 2,310 Posts
          @Plavet
          You could use the alias of the document as the name of the image.
          e.g doc alias = home, have an image named home.jpg
          You should then be able to have something like this on each page:
          <img src="assets/images/[*alias*].jpg" title="[*alias*]" alt="[*alias*]" />

          It should show a different image on each page.
          Tested very quickly!

          David
            • 37272
            • 216 Posts
            Quote from: dev_cw at Jan 10, 2008, 06:45 AM

            No sure if I understood. But my recommendation would be to use a conditional statement (either a snippet or with PHx) to load the chunk with the additional html when needed.

            As for putting a TV in a chunk, this should work I do it all the time. If it is not parsing, then change the snippet call to uncached [!snippet!] rather than cached [[snippet]].

            Hi,

            This is what I tried:

            Main Template
            TV call to document1
            Document1 has Template2 assigned to it (template2 is just some additional HTML I’d like to surround Document1)

            So, I should end up with:

            Main Template
            additional HTML
            Document1
            /additional HTML
            /Main Template

            Is that clearer?

            As I said though, template2 is not called with document1 - I just end up with the content of document1, not the additional HTML from the second template. The idea was to have clean docs with little or no HTML contained within them.

            Can I really place a TV within a chunk? If I cannot change the TV with each document, how is this a variable? I guess I have some testing to carry out. Although I’ve been using Modx for some time, I use it only for my site, so I do very little experimenting. I’m going for a total overhaul of the site and I’m discovering all sorts of improvements over my first Modx design, and my first experiences of CSS for that matter.

            Thanks.
              • 23562
              • 57 Posts
              @bunk58

              Oh yeah it worked like a charm!!! grin I must start thinking like that! grin
              Thank you sooo much!!! I will try to use your dock menu for this site
              ’am currently working on, if it fits into the design of the site, it would be great,
              if not, well I’ll just use it elsewhere grin its so nice and unusual rolleyes

              Thanks again!!!

              Igor