We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 6208
    • 44 Posts
    I hope this hasn’t bee asked and answered repeatedly:

    I have a single page on my site that is a listing of "MVPs." It has repeating blocks of content incorporating a photo, name, blurb and divider graphic. Because of the structured nature of the data and the fussiness of the underlying CSS, it seems to me the easiest way to do this is to create a template that has the exact layout for one these repeating blocks and include the various fields as Template Variables. This way I can control the exact layout of each block, and I would then create a new page with this template for each MVP.

    Easily done. Here’s the page in question:

    http://www.athleticmindedtraveler.com/about_us/our_mvps.php

    Next, what I want to do is write a snippet that takes the output from each of these individual member pages and lists them on my single MVPs page. So my question is this: Is there a way to fetch the entire output of a page, its content and its template variables exactly as the page would render? This would be something like $modx->getPageOutput($id). I’m sure I can do it by writing a function to output the content and template variables, etc, but it seems as though there should be a simple way to take the formatted output of one page and include it in another page.

    Thanks for your help. I continue to be amazed by the possibilities and flexibility of MODx.
    • The problem with getting the combined document output from a page is that it depends on the template it is sitting in (i.e. you can’t place an entire template with full HTML HEAD and BODY tags inside another template that has those tags). It might be possible, if all your TV tags are being output in the main content area of your MVP pages, to just pull that main content area into a summary document using a TV and the @DOCUMENT binding, or directly in a snippet; otherwise, your best bet is to follow the model of the NewsListing snippet so you can take the content and TV’s from a set of MVP pages and summarize them.

      Now, if you really have no need for a separate page for each MVP, there might be some alternate approaches, but I’d have to think about that a little more... cool
        • 6208
        • 44 Posts
        Right, the sub-templates I’ve created have no <html> or <body> tags. It’s just the chunk of code I need for that particular layout. I don’t necessarily NEED to have a separate page for each MVP, but I don’t see any other way of creating repeated blocks of information.

        But in other words, when I say I want to get the document output from a page I mean I want the output including the template and TVs and everything. I want to take a page as it would be rendered in the browser and include it in other page.

        Thanks!
          • 18397
          • 3,250 Posts
          cyberk, I did just what you ask for the rosters on ecrbaseball.com!

          I did the following:

          1. Created a full document template for each player using TV’s for player info such as #, class, height, weight, etc.

          2. Used NewsListing to display the tv’s from each player bio using the tpl parameter and prefixing tv’s with the phrase "tv" (in other words the template variable cheese could be called in the chunk as [+tvcheese+].

          3. Wrapped the NewsListing output into a table for clean display and volia!

          If you need a hand setting this up let me know.
            • 6208
            • 44 Posts
            Thanks, Mark. I’ll give that a peek.

            I may just also write my own Snippet to do similar to what NewsListing does, but in a more "lightweight" manner.

            Thanks again!

            Andrew