We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 19777
    • 35 Posts
    I’m trying to modify to Ditto 1.1 beta (and 0.9.5 beta 1) to only show events that are happening on particular days of the upcoming week. On the Daily Guide page (as in the sample Document Tree below), I’m wanting to show a list of events that are occuring today (I’m also wanting to make subsequent pages that show events occurring on each of the following 6 days). The event pages have a tvEventDate that is set to Unixtime. I’m making a Ditto call from the Daily Guide page (as below) and get an error message instead. I’ve included my modifications to the filter.class.inc.php file, if that helps.

    Sample Tree Structure:

    Site Root
    |
    |-->Daily Guide (Document making modified Ditto call)
    |
    |-->Venues (ID = 6)
    | |
    | |-->Bar
    |
    |-->B
    |
    |-->Bar Beginning With B
    |
    |-->Upcoming Events
    |
    |-->Some Event (has TV = "EventDate)

    [!Ditto? &startID=`6` &idType=`parents` &hideFolders=`1` &depth=`6` &seeThruUnpub=`1` &sortBy=`tvEventDate` &filter=`tvEventDate,5,dailyguide` &tpl=`BrowseVenuesMainDitto`!]
    


    Inserting this in the function basicfilter()
    case "dailyguide" :
    		$nextWeek = time() + (7 * 24 * 60 * 60);
    		$arrayday = getdate($value[$this->array_key]);
    		$DocumentsDay = $arrayday["wday"];
    		$TodaysDay = getdate();
    		$TD = $TodaysDay["wday"];
    		if ($DocumentsDay != $TD) {$unset = 0;}
    		if ($nextWeek< $value[$this->array_key]) {$unset = 0;}	
    		break;
    


    I get the following error:
    PHP error debug
      Error: 	getdate() expects parameter 1 to be long, string given	 
      Error type/ Nr.: 	Warning - 2	 
      File: 	/Library/WebServer/Documents/trunk/assets/snippets/ditto/classes/filter.class.inc.php	 
      Line: 	157	 
      Line 157 source: 	$arrayday = getdate($value[$this->array_key]);
    


    The thing is, the exact same call works on some pages - just not on a page that is not a parent of the documents that Ditto is filtering (as is the case with my Daily Guide page). Why it works on one page and not the other is a mystery.

    Any help would be greatly, greatly appreciated. Maybe a better way of doing this.

    Cheers

    mark
      • 18397
      • 3,250 Posts
      MARKSVIRTUALDESK Reply #2, 20 years ago
      I’ll set up something on my test server and get back to you.
        • 19777
        • 35 Posts
        Thanks Heaps Mark!
          • 19777
          • 35 Posts
          I solved the issue. Ended up radically restructuring the site, upgrading to Rev1433, reduced the number of sub-folders and learnt a bit more of the Modx API, low and behold it all works peachy now. There was an obvious type incompatability between the two which was causing the error - late nights and obvious problems don’t mix well. Still not sure why it worked in one folder and not the other. But I guess it really doesn’t matter now.

          Thanks

          Mark
            • 18397
            • 3,250 Posts
            MARKSVIRTUALDESK Reply #5, 20 years ago
            Could you share the code that worked with us in case this question is asked again?
              • 19777
              • 35 Posts
              No worries. i will upload the code when I’ve finished checking everything. Just want to make sure it doesn’t cause some incompatabilities elsewhere.