We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 10780
    • 69 Posts
    I thought this was possible. Say I have resources like images that will be displayed on different pages, but use the same standard code. Rather than me creating templates for each page I want to abstract it out into 1 template, so it doesn’t matter what page I am on, it will still run the code.

    Ok, this is the page I am working on:

    http://www.webtise.net/~leasowca/

    Now as you can see (if i’ve not worked it out yet) is an empty image tag.

    The code I am using is thus:

    I am calling this chunk from my Home template:

    {{slideshow}}


    Which contains this code:

    <div id="slideshow">
    [[Ditto? &tpl=`hero-slides` &orderBy=`menuindex ASC`]]
    </div>


    Which uses this template:

    <img src="[+slide+]" alt="" title="" />


    Now on my Home page in the tree structure I have a blank template called Heroes (18) and within that blank template I have my resources, my slides. If I give the ditto a parent of 18 then it works, but what happens when I want to use the same code on a sub page? I would rather not have to keep rewriting the code.

    Does that make sense?

    Anyone who can help me would get good will and cheer for a lifetime. smiley
      • 36582
      • 463 Posts
      I’m finding this difficult to follow? Sometimes when you say ’template’ do you mean page?

      It sounds like you should either call your chunk via a tv or use the &documents command in ditto and paerhaps call the document via a tv?
        Web site design in Nottingham UK by Chris Fickling http://www.chrisficklingdesign.co.uk
        • 10780
        • 69 Posts
        No when I say template I mean template.

        Thing is, this method is kind of working for my sub navigation. You see when I click on Conferences for example - http://www.webtise.net/~leasowca/index.php?id=5 - I get my sub nav down the left, and I am pretty much calling these the same:

        This is in a Template called Sub Template:

        <div id="left-sidebar" class="grid_3 alpha">
        {{sub-nav}}
         </div>


        The chunk

        <ul id="sub-nav">
        [!Ditto? &parents=`[[UltimateParent]]` &tpl=`sub-list-nav` &orderBy=`menuindex ASC`!]
        </ul>


        I know I am using UltimateParent there - but I tried both ways and still no dice for my Slideshow.

          • 10780
          • 69 Posts
          Actually, my sub navs are resource children of the top level pages.

          My slideshow images are resource children of a blank template/page called Heroes, which is in turn a resource child of the top level pages.




          (sorry yes, when I say blank templates it a page resource container)
            • 10780
            • 69 Posts
            have added &depth=`2` and so far so good.
              • 36582
              • 463 Posts
              Thought there was some template confusion there!

              I would change ’hen do’ to ’hen party’ by the way! wink
                Web site design in Nottingham UK by Chris Fickling http://www.chrisficklingdesign.co.uk
                • 10780
                • 69 Posts
                Ah not my decision unfortunately.

                Weird thing now is an extra image is getting dropped in and it’s blank. I have no other resources so no idea where it is picking this up from.
                  • 10780
                  • 69 Posts
                  Right so basically it’s not working as planned. I am picking up an extra image. This is so annoying, why can’t it be simple???
                    • 36582
                    • 463 Posts
                    Is it picking up a ’default’ image that’s not there?

                    Nice site by the way.
                      Web site design in Nottingham UK by Chris Fickling http://www.chrisficklingdesign.co.uk
                      • 10780
                      • 69 Posts
                      It must be, driving me mad.