We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 19889
    • 616 Posts
    Hello,
    I guess I need a little guidance on this.

    I’ve a folder that holds some documents (events) - I created some tvs for the start and end date of the event.

    first of all, when showing e.g. the start date in the template like this: [+tvStartDate+], I’m just getting the unixtime - how can this be converted to show the proper date.

    on the main folder page, I’ve the following Reflect call:
    [!Reflect?&sortBy=`tvEventStartDate`&dateSource=`tvEventStartDate`&dateFormat=`%d. %B %Y, %H:%M:%S`&config=`vsbtu-news` &getDocuments=`1`&dittoSnippetParameters=`parents:68|summarize:all|hideFolders:1|showPublishedOnly:0`&tplContainer=`tpl-Events`&tplItem=`tpl-EventItem`&monthSortDir=`desc`&filter=`tvEventStartDate!]
    
    


    this results in the following error: The Ditto object is invalid. Please check it.

    When placing a ditto call on the same page, I’m kind of getting the expected result but I’m getting the following where the ditto call is: No documents found.

    Two questions now: Does reflect only works with ditto and if yes, how do I get rid of the ’no documents found’ message.

    Thank you in advance for your help.
      • 18397
      • 3,250 Posts
      1. Remove &filter=`tvEventStartDate
      2. Use [+date+] in your tpl instead of your tv
        • 19889
        • 616 Posts
        Quote from: Mark at Dec 18, 2007, 08:34 AM

        1. Remove &filter=`tvEventStartDate
        2. Use [+date+] in your tpl instead of your tv

        Hello Mark,

        Thanks for replying - I’d like to show the start date and the end date of the event if there is an end date - how do I do that if I just place the [+date+] placeholder. do I need to have the ditto call as well or can this be done by just using Reflect?

        Thank you

        still no luck when trying to format my two dates - as to the no result text, I was playing around with the noResults parameter - setting it to blank like this $noResults = ’’ doesn’t seem to work.

        was just trying to add &phx to the call and using something like this: [+tvEventStartDate:date="%d.%m.%Y"+] - doesn’t work either - I’m just getting some blank space.

        this is the config file - just in case:
        // set locale	
        	setlocale(LC_ALL, 'de_DE@euro', 'de_DE', 'de', 'ge');
        	
        	// parameters
        	$targetId				= 68;
        	$parents 				= 68;
        	$getDocuments			= 1;
        	$dateSource				= 'tvEventStartDate';
        	$sortBy					= 'tvEventStartDate';
        	$monthSortDir			= 'desc';	
        	$dateFormat 			= '%d. %B %Y'; // '%d. %B %Y, %H:%M:%S'
        	$language 				= 'german';	
        	$dittoSnippetParameters	= 'parents:68|summarize:all|hideFolders:1|dateSource:tvEventStartDate|sortBy:tvEventStartDate';
        	
        	// templates
        	// container
        	$tplContainer	= '@CODE:
        		<div class="reflect_archive_list">
        			<ul class="reflect_archive">
        				[+wrapper+]
        			</ul>
        		</div>';
        
        	// year
        	$tplYear		= '@CODE:
        		<li class="reflect_year">
        			<h3 title="[+year+]">[+year+]</h3>
        			[+wrapper+]
        		</li>';
        		
        	// month	
        	$tplMonth		= '@CODE:
        		<li class="reflect_month">
        			<h4 title="[+month+] [+year+]">[+month+]</h4>
        			[+wrapper+]
        		</li>';
        		
        	// item	
        	//<li>[+tvEventStartDate+]</li>	
        	$tplItem		= '@CODE:
        		<li class="reflect_item">
        			<ul class="small">			
        				<li>[+tvEventStartDate+]</li>
        				<li>[+tvEventEndDate+]</li>
        				<li>[+pagetitle+]</li>
        				<li>[+longtitle+]</li>
        				<li>[+tvEventLocation+]</li>
        			</ul>
        		</li>';
          • 19889
          • 616 Posts
          Hello,

          I’m having some other difficulties with using a config file - from my understanding all parameters could also be set in the config file - $language = ’german’ just seems to be ignored - I even tried to add just that one line to the default.config file - no success!

          is anybody experiencing similiar problems?

          adding language to the ditto call works just fine;
            • 19889
            • 616 Posts
            anybody? I really need this to get fixed, especially the problem with the $language parameter - is it possible to set it in the config file or do I have to set it to the ditto call which seems to be the case at the moment.

            anybody else experiencing similar problems with the config file?

            thank you guys and sorry for bumping
              • 7231
              • 4,205 Posts
              I was unable to make it work with the config as well. However if you want to have the default be german rather than english you can hard code it into the snippet code (in the manager snippet editor). It is about the third option from the top, change this line:

              $language = (isset($language))? $language : "english";

              to
              $language = (isset($language))? $language : "german";
              This will make german the default language.

                [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

                Something is happening here, but you don&#39;t know what it is.
                Do you, Mr. Jones? - [bob dylan]
                • 27708 MODX Staff
                • 2,502 Posts
                mmjaeger,

                Using Ditto and en event date I did the following in my Ditto template to show the date formatted.

                [+phx:if=`[+event_date+]`:isnot=``:then=`[+event_date:date=`%A, %B %d at %I:%M %p`+]`:else=` `+]


                The reason for the conditional in mine is that I wanted my client to be able to mix events an news items via the same feed. Events show an event date if there is one and news items don’t have an event date so they are blank and therefore shouldn’t display one.

                You could do this:
                [+phx:if=`[+event_date+]`:isnot=``:then=`[+event_date:date=`%A, %B %d at %I:%M %p`+]`+]


                One question too, are is your tv actually named tvEventStartDate? or EventStartDate. Later versions of Ditto don’t look for the a tv prefix added in the templates. Of course if your tv is named tvEventStartDate than by all means use it.

                On the config file, you’ll need to keep searching for answers.

                Cheers,

                Jay
                  Author of zero books. Formerly of many strange things. Pairs well with meats. Conversations are magical experiences. He's dangerous around code but a markup magician. Blog ✦ Twitter ✦ LinkedIn ✦ GitHub
                  • 19889
                  • 616 Posts
                  I’ll give it a try - thanks

                  can’t get it to work - this is the code I have:
                  <dt>Event date: [+phx:if=`[+tvEventEndDate+]`:isnot=``:then=`[+tvEventEndDate:date=`%A, %B %d at %I:%M %p`+]`+]</dt>


                  and this is what I get on the page:
                  Event date: `+] 


                  am I doing something wrong?
                    • 4310
                    • 2,310 Posts
                    EventStartDate,@EVAL return time()

                    Is what I’ve used in a similar sorting by date situation, I didn’t output the actual date so can’t remember the format!
                    Might be worth a try

                    David

                    EDIT

                    Ignore me I’m stupid, this function only returns events later than now, it was late when I posted it!
                      • 27708 MODX Staff
                      • 2,502 Posts
                      I assume that you have PHx installed correctly? You might try re-uploading PHX into the /assets/plugins folder. Your call seems to look correct but sometimes when you look at such calls they all look the same.

                      Again, I ask is your TV named "tvEventEndDate" or "EventEndDate". For use with PHx you don’t prepend the name in your call with "tv" unless your TV name is actually prepended with "tv".

                      All the best,

                      Jay
                        Author of zero books. Formerly of many strange things. Pairs well with meats. Conversations are magical experiences. He's dangerous around code but a markup magician. Blog ✦ Twitter ✦ LinkedIn ✦ GitHub