We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 46811
    • 4 Posts
    i would like to know if is it possible to use getresources (oh off-topic, but GREAT ONE guys! ) to get the full page... I'm doing a slideshow (with full html for every slide) and every slide is a page (not with head and that sort of things...), but with TV, and i would like to import it in another one... I know u can use ayax to that but i would like to use server side script: like using a sort of include(index.php=id)...
    Is there another way to create a include (modx page) snippet?

    Thanks!
    • Yes. Your tpl would need to be the slideshow template, and you would need to use the &includeContent property as well as the relevant TV inclusion and processing properties.

      http://rtfm.modx.com/extras/revo/getresources#getResources-OtherProperties
        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
        • 46811
        • 4 Posts
        thanks for the fast reply!
        but the problem is that slides have differents templates: for example one is a demo with a link (selected by tv) and others are images (tv) with descriptions (content): i would like to get directly the page (like a php include, ora an ajax, jquery, call .load() )... [ed. note: bombus last edited this post 10 years, 4 months ago.]
          • 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
            • 22840
            • 1,572 Posts
            Yoy can use conditional templates in get resources,

            For example create a new template for each of the slide layouts then in your gerResorces call do the conditions:

             [[getResources?
            		  &parents=`[[*id]]`
            		  &tplCondition=`template`/* needed, dont change */
            		  &conditionalTpls=`{"5":"LeftSemiBlackWithText","15":"WhiteThreeBlocks","6":"BottomRightImageTopRightText"}` /* template id followed by template name */
            		  &tpl=`hs-news` /* name of the fall back template */
            		  &tvPrefix=``
            		  &includeTVs=`1`
            		  &processTVs=`1`
            		  &showHidden=`true`
            		  &limit=`40`
            		  &pageVarKey=`page`
            		  &element=`getResources`
            		  &elementClass=`modSnippet`
            		  &sortdir=`ASC`
            		  &sortby=`menuIndex`
            	  ]]


            Then in those templates place a get resources call like normal, this is the LeftSemiBlackWithText which calles a chunk with the same name which contains the slider code with that html

            [[getResources?
              	&parents=`[[*id]]`
            	&depth=`3`
              	&tpl=`LeftSemiBlackWithText`
               	&tvPrefix=``
            	&includeTVs=`1`
            	&processTVs=`1`
            	&showHidden=`true`
            	&limit=`40`
            	&pageVarKey=`page`
            	&element=`getResources`
            	&elementClass=`modSnippet`
            	&sortdir=`ASC`
            ]]


            LeftSemiBlackWithText chunk:

            <!-- Each child div in #showcase represents a slide -->
            	<div class="showcase-slide">
            	<!-- Put the slide content in a div with the class .showcase-content -->
            		<div class="showcase-content">
            		<!-- If the slide contains multiple elements you should wrap them in a div with the class .showcase-content-wrapper. We usually wrap even if there is only one element, because it looks better. :-) -->
            			<div class="showcase-content-wrapper">
            				<img src="[[+SemiBlackImage]]" alt="" />
            					<div class="left-content">
            						<div class="value">
            							<p>Rotary value:</p>
                                        <span>[[+Value]]</span>
                                    </div>
                                    <div class="client-details">
            							<dl>
            							[[+Client:notempty=`<dt>Client:</dt>
                                            <dd>[[+Client]]</dd>`]]
                                           [[+Consultant:notempty=`<dt>Consultant:</dt>
                                            <dd>[[+Consultant]]</dd>`]]
            								[[+Contractor:notempty=`<dt>Main Contractor:</dt>
                                            <dd>[[+Contractor]]</dd>`]]
            								[[+Completion:notempty=`<dt>Completion:</dt>
                                            <dd>[[+Completion]]</dd>`]]
            
            								[[+Duration:notempty=`<dt>Duration:</dt>
                                            <dd>[[+Duration]]</dd>`]]
            
            							</dl>
            						</div>
            						[[+Photo:notempty=`<div class="photo">
            							<p>Image courtesy of <br />[[+Photo]]</p>
            						</div>`]]
            					</div>
            				</div>
            			</div>
            		</div>


            I don't think this is actually documented so can't point you to any tutorials
              • 3749
              • 24,544 Posts
              There are a few other options. One is to get the pages with cURL and show them in an iFrame. Another is PHP's file_get_contents('url_to_resource'). Finally, there is a snippet for getting a fully processed Resource by OpenGeek that might work, but I can't find it.
                Did I help you? Buy me a beer
                Get my Book: MODX:The Official Guide
                MODX info for everyone: http://bobsguides.com/modx.html
                My MODX Extras
                Bob's Guides is now hosted at A2 MODX Hosting
                • 46811
                • 4 Posts
                first of all: Thanks to everyone!


                try 1: my idea
                I've tryed one thing that didn't work (sob...):
                I've done a chunk instead of template containing all TV needed to be processed to get the single slide and it worked for the single view.

                for example a slide with an image (it's a little big cause it contains svg inline, and it uses italian in classes, cause i'm italian... ) :

                <div id="slide_1" class="slide_singola" style="background-image: url([[*ImageFullUrl]]);">
                	<div class="descrizione_slide">
                		<div class="spaziami">[[*description]]</div>
                		<div class="contenitore_bott_slide">
                			<a href="JavaScript:void(0);" title="slide precedente" class="">
                				<div class="button sinistra_bottone" id="frecce_button" onclick="[[*prev_function]]">
                					<svg class="icon_container_button" version="1.0" id="Livello_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="64px" height="64px" viewBox="0 0 64 64" style="enable-background:new 0 0 64 64;" xml:space="preserve">
                							<path class="icon_button" d="M28.708,43.007l-9.643-9.644c-0.754-0.753-0.754-1.973,0-2.727l9.643-9.643c0.753-0.753,1.974-0.753,2.727,0 s0.753,1.974,0,2.727l-6.351,6.351h18.487c1.065,0,1.929,0.862,1.929,1.928c0,1.065-0.863,1.929-1.929,1.929H25.084l6.351,6.351 C31.812,40.656,32,41.149,32,41.643c0,0.494-0.188,0.988-0.565,1.364C30.682,43.76,29.461,43.76,28.708,43.007"/>"/>
                					</svg>
                				</div>
                			</a>
                			<a href="JavaScript:void(0);" title="slide successiva" class="">
                				<div class="button destra_bottone" id="frecce_button" onclick="[[*next_function]]">
                					<svg class="icon_container_button" version="1.0" id="Livello_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="64px" height="64px" viewBox="0 0 64 64" style="enable-background:new 0 0 64 64;" xml:space="preserve">
                						<path class="icon_button" d="M35.292,43.007l9.643-9.644c0.754-0.753,0.754-1.973,0-2.727l-9.643-9.643c-0.753-0.753-1.974-0.753-2.727,0 s-0.753,1.974,0,2.727l6.351,6.351H20.429c-1.065,0-1.929,0.862-1.929,1.928c0,1.065,0.863,1.929,1.929,1.929h18.487l-6.351,6.351 C32.188,40.656,32,41.149,32,41.643c0,0.494,0.188,0.988,0.565,1.364C33.318,43.76,34.539,43.76,35.292,43.007"/>"/>
                					</svg>
                				</div>
                			</a>
                		</div >
                	</div>
                </div>
                


                then i've created a template for the slideshow main page (id 17)
                <div class="diapositive_base" id="diapositive_base">
                [[getResources?
                  &tpl=`Slideshow1`
                  &parents=`17`
                  &depth=`2`
                  &limit=`5`
                  &includeContent=`1`
                  &includeTVs=`1`
                  &showHidden=`1`
                  &hideContainers=`1`
                ]]
                </div>
                <div class="logo_up_slide" onclick="tornaacasa()" style="position:fixed; background-color:rgba(0,0,0,0.6);"></div>


                and a chunk (tpl) Slideshow1
                [[+content]]

                but it's not processed

                i've tryed Slideshow1
                [[*content]]

                -> totally broken code...

                probably is what is written here : http://forums.modx.com/thread/?thread=31539&page=1 (was this what you are referring to, @BobRay? )

                try 2: be brutal
                so i uploaded a brutal php code in the root:
                <div style="" class="diapositive_base" id="diapositive_base">
                	<?php 
                	include ('index.php?id=18')
                	?>
                	<?php 
                	include ('index.php?id=19')
                	?>
                	<?php 
                	include ('index.php?id=20')
                	?>
                	<?php 
                	include ('index.php?id=21')
                	?>
                	<?php 
                	include ('index.php?id=22')
                	?>
                </div>
                	

                -> nothing shows there...

                next try
                now i'm gonna try other options all of u suggested ... (thanks paulp and scottwell! ) but my intent is to have a simple way to do a page and include it as a slide in the slideshow...

                last chance
                if I'd no simple output i'm gonna use ajax another time... (all site is already done with it...)
                Does ajax inside a ajax gives problems? we will see...

                Thanks to all - i'm gonna tell about will happen!
                  • 3749
                  • 24,544 Posts
                  No, that's not what I was referring to. I found that, but there's another more recent posts with actual snippet code by OpenGeek for processing the resource. I'm not sure it would do what you want anyway.

                  Another thing to try is:

                  <iframe id="frame1" src="[[~12]]"></iframe>
                  <iframe id="frame2" src="[[~14]]"></iframe>
                  <iframe id="frame2" src="[[~27]]"></iframe>
                  


                  Here's a snippet to produce that output.

                  This tag where you want the slide show:

                  [[ShowPages? &ids = `12,14,27`]]


                  <?php
                  /* ShowPages snippet */
                  
                  $output = '';
                  $docIds = explode(',' $scriptProperties['ids']);
                  
                  $i = 1;
                  foreach($docIds as $docId) {
                      $url = $modx->makeUrl($docId, "", "", "full");
                      $output .= "\n<iframe id=" . 'frame' . $i . ' " src="' . $url . '"><iframe>';
                      $i++;
                  }
                  
                  return $output;
                  


                  This will show them all, but since they have unique IDs (frame1, frame2, etc.), you can use JavaScript to make a slideshow out of them.


                    Did I help you? Buy me a beer
                    Get my Book: MODX:The Official Guide
                    MODX info for everyone: http://bobsguides.com/modx.html
                    My MODX Extras
                    Bob's Guides is now hosted at A2 MODX Hosting
                    • 46811
                    • 4 Posts
                    thanks BobRay! I'm gonna try that tomorrow (it's 4.28 AM here)... as far as i know iframe loads a full html page inside of it with their own css, but i share css with every page (custom styles are inline), that's why i'm using ajax: I load only the divs needed by the "page" it's showing... i was looking for a way to get the full html compiled by the server like getresources output...

                    here's my site on modxcloud: http://sid.bombus.modxcloud.com

                    if u wanna check it out (it need more polishing on the code side...)

                    click on the first icon from the top on the left (the one with windows) -> select one of the option (there are two for now) -> "più informazioni" button ("more info", italian way) -> here's the slideshow (very simple but use only css3 3d transformation to slide -> good for devices wink )... u can see in the code that, for now, there is jQuery ajax, but it's still hurting a little bit low-ended phones... i'd tried html precompiled and works a little better, that's why i'm searching for a server-side result... still lookin for a snippet that can get to that!

                    if you want to see only the code from the slideshoew is: http://sid.bombus.modxcloud.com/index.php?id=23 but as i said before it misses a lot of things that are inside the main html...

                    ps OT : i've not done the demo thing but I'll do that later... ah the demo thing will be a html representation of the front-end (can't be responsive or can but i need to know better svg) and one sample for the site wink

                    still thanks for the help! [ed. note: bombus last edited this post 10 years, 4 months ago.]
                      • 4172
                      • 5,888 Posts
                      perhaps a single-page-app, for example done with angularJs is the way to go.
                      Here's a thread, which may help to get an idea:
                      http://forums.modx.com/thread/89310/angularjs-router-index-html-spa-039-s-and-modx-index-php#dis-post-491930
                        -------------------------------

                        you can buy me a beer, if you like MIGX

                        http://webcmsolutions.de/migx.html

                        Thanks!