We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 13445 ☆ A M B ☆
    • 18 Posts
    I can't for the life of me figure this one out and thought I'd throw it out to see if anyone had some suggestions.

    I am building a logo scroller for the Technology Association of Georgia's Anual report. They have sponsors and several levels of sponsors. Premiere, Platinum, Gold and Silver. I've set up two TVs on the sponsors documents A radio button determining the level (same as the above list) and a 2 image TV One for the sponsor page itself and one for the homepage scroller.

    Building the scroller is easy. Little getResources call that builds this (albiet very simplified example) :
    <a href="premiereSponsor.html"><img src="logo.png" /></a>
    <a href="silverSponsor.html"><img src="logo2.png" /></a>
    etc...


    It would generate the link to take it to the right page based on the sponsor type TV and of course drop the logo in.

    Here's where it gets hairy. The client has asked that:

    Premiere Sponsors appear every 5th logo
    Platinum Sponsors appear 3 times as often as the Gold and silver
    Gold and silver appear once.

    But also

    No two logos are the same side by side.

    Any thoughts as to how to proceed on this one? If all else fails I can make them edit the raw HTML for it and put them in manually but I really want it to use the TVs I've set up and make it automatic.

    Any ideas would be appreciated!
      Senior Designer at Arketi Group - http://www.arketi.com
      Twitter - @jalterixnar - https://twitter.com/jalterixnar

      “There is no dishonor in failing, only in the failure to try.” – Elder fire dragon Kaernyth
      • 42049 ☆ A M B ☆
      • 250 Posts
      MIGXTV and drag them to the order you want them to display?

      Or jQuery, make classes and at page load put them all into an array, and then render them out one at a time based on conditions you code?
        GEL STUDIOS
        MODX Professional | MODX Ambassador

        Website | Email | Twitter | Facebook
        • 38290
        • 712 Posts
        The question is do they want them to be otherwise random, or just have complete control over them? One whole in their logic is the only way all the premieres show up is if the total is evenly divisible by 5. Also if platinum appear three times as often as something that appears once, you can just say platinum appear three times.

        This is what I got so far, but eh

        $premieres = array();
        platinums = array();
        $gold = null;
        $silver = null;
        
        // sort them
        foreach($resources as $resource) {
        	switch($sponsorType) {
        		case 'premier':
        		$premieres[] = $resource;
        		break;
        				
        		case 'platinum':
        		$platinums[] = $resource;
        		break;
        		
        		case 'gold':
        		if(!$gold) $gold = $resource;
        		break;
        		
        		case 'silver':
        		if(!$silver) $silver = $resource;
        		break;
        	}
        }
        
        // store prems in empty array with values every 5th element
        $slots = array();
        $f = 4;
        foreach($premieres as $premiere) {
        	$slots[$f] = $premiere;
        	$f += 5;
        }
          jpdevries
          • 13445 ☆ A M B ☆
          • 18 Posts
          Thanks for the input on these too. I've been so slamed that I never had time to come back to it. After all the craziness they decided to make it so the Premiere sponsor appeared every fifth logo. As it turned out that was a breeze.

          Thanks for the ideas on this as I am sure it'll come up again for some client or other!
            Senior Designer at Arketi Group - http://www.arketi.com
            Twitter - @jalterixnar - https://twitter.com/jalterixnar

            “There is no dishonor in failing, only in the failure to try.” – Elder fire dragon Kaernyth