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

    I have a video gallery, and I want to add a 'new' flash to any videos published in the last seven days. I can do this with CSS, so just need to add a class, but unsure on how to add it. I'm thinking it's an output filter?

    Thanks
    Andy

    This question has been answered by tm2000. See the first response.

      • 46886
      • 1,154 Posts
      I think the important question is how do you manage your videos? Whatever solution you choose depends on your management system
        • 46309
        • 79 Posts
        Can you please provide more details here - code, chunks etc. in order someone to help you.
          peace&love / bike&ride
          • 51020
          • 670 Posts
          Quote from: deyand at Apr 27, 2016, 01:32 AM
          Can you please provide more details here - code, chunks etc. in order someone to help you.

          Good point. I'm using simple resources with a TV for the youtube Id - so each resource has it's own publish date. I want to use that somehow to calculate when it's less than a week old.

          Does that make sense?

          Andy
            • 51020
            • 670 Posts
            Quote from: deyand at Apr 27, 2016, 01:32 AM
            Can you please provide more details here - code, chunks etc. in order someone to help you.
            Apologies - Im use getresources as so:

            [[!getResources?
            &parents=`[[*id]]`
            &limit=`1000`
            &processTVs=`1`
            &includeTVs=`1`
            &showHidden=`1`
            &tpl=`singleYoutubeVideo`
            ]]

            Then my tpl is this:

            <li>
            <a href="http://youtube.com/watch?v=[[+tv.YouTubeID]]?&autoplay=1&iframe=true&width=900&height=500" title="[[+YoutubeHeading]]">
            <p>Published: [[+publishedon:strtotime:date=`%b %Y`]]</p>
            <h2>[[+pagetitle:ellipsis=`100`]]</h2>
            </a>
            </li>

            All working fine, and I have the published date - so just need to calculate whether the resource is less than one week old?
              • 30912
              • 463 Posts
              You'd need a script to evaluate the pub date and output the class if its within 7 days - i had one at my old company which did exactly the same thing - however I no longer have access to that resource.
                • 3749
                • 24,544 Posts
                You might give this a try (change &limit to however many you want to show):

                [[!getResources?
                    &parents=`[[*id]]`
                    &limit=`10`
                    &sortby=`publishedon`
                    &sortDir=`DESC`
                    &processTVs=`1`
                    &includeTVs=`1`
                    &showHidden=`1`
                    &tpl=`singleYoutubeVideo`
                ]]



                  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
                  • 51020
                  • 670 Posts
                  Quote from: BobRay at Apr 27, 2016, 09:33 AM
                  You might give this a try (change &limit to however many you want to show):

                  [[!getResources?
                      &parents=`[[*id]]`
                      &limit=`10`
                      &sortby=`publishedon`
                      &sortDir=`DESC`
                      &processTVs=`1`
                      &includeTVs=`1`
                      &showHidden=`1`
                      &tpl=`singleYoutubeVideo`
                  ]]





                  Thanks Bob - the sorting is fine - it's just that i want to add a label to all new resources (ie, under a week old). Seems like i need a snippet which calculates the age and outputs a class to the li?

                  ANdy
                    • 51020
                    • 670 Posts
                    Quote from: Tyreal2012 at Apr 27, 2016, 08:15 AM
                    You'd need a script to evaluate the pub date and output the class if its within 7 days - i had one at my old company which did exactly the same thing - however I no longer have access to that resource.
                    Yes precisely - but that's the bit I don't know how to do! smiley
                      • 30912
                      • 463 Posts
                      Cant help you there i'm afraid, I had a look to see if i still had the script in my mail but doesnt look like it sorry sad