We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 18397
    • 3,250 Posts
    Thanks!
      • 32847
      • 171 Posts
      Yesterday, I read a message from Davidm about filtering but your message is not here this morning huh
      May be I had a dream or you deleted it?
      I was interested by the problem.
        • 6726
        • 7,075 Posts
        I deleted it you didn’t dream it, I should have edited it instead, sorry... I figured out the answer while re-reading my own post (sometimes formulating a problem helps you solve it...), and felt somewhat stupid about asking tongue

        Here it is (thanks Zi !)

        I really have some trouble understanding the filter parameter... When I define a filter, I just get a blank output.

        Here is the thing : I have documents which contain a certain number of TV fields (date, place, price...).

        I want to create pages that list those documents according to different criterias. It means I’d want one page listing all travels in the Alsace region, another listing of travels that last a week-end, etc. Those listing would point to a "more" page with all the details about a particular travel.

        An information page about a given travel is not a children of a particular folder, since I can have a travel which lasts a week-end and takes place in Alsace it has to be displayed on both listing and the "more" link has to point toward the same detail page.

        It’s fairly straightforward, I realize that, but I have some trouble making it work...

        "lieu" is the TV for the place where the travel takes place and it can have three values : Alsace||France||International. I have tried the following on the page I want all travels taking place in the Alsace region.

        Code:
        [!NewsListing? &tpl=`fiche` &filter=`tvlieu,Alsace,1` &truncText=`Voir le détail de la fiche` &emptytext=`Désolé, pas de fiche dans cette catégorie`!]



        The chunk named ’fiche’ has the following code :

        Code:

        <h3>[+title+]</h3>
        <p class="infos_fiches">»  Le [+tvdate_debut+] | [+tvduree+] | [+tvprix+] € TTC</p>
        <div class="lien_fiche">[+link+]</div>



        It does not output anything, thus I probably have a faulty understanding of the snippet’s logic.

        Could someone enlighten me there ?

        Mark has answered my problem

        Well, to anwser his question, the tv name must actually be called in the template or in the hiddentvs (I think thats what I named it...) parameter. At first glance, thats most likely why its not filtering right.

        Hidden tv’s are tv’s that you either want to sort by or filter by that don’t appear in your NewsListing template.

        I hope this helps.
          .: COO - Commerce Guys - Community Driven Innovation :.


          MODx est l&#39;outil id
          • 8461
          • 205 Posts
          Mark, For the sake of clarity

          We have to overwrite the contents of NewsListing with the contents of the file snippet.newslisting.6.2.txt, however the download file is called snippet.newslisting.6.2.php.

          Can you confirm if I just extract the code on the page and put this is my newslisting snippet or any new snippet I create

          many thanks
            • 18219
            • 826 Posts
            David,

            Les noms des TV doivent être ’date_debut’, ’duree’, etc.
            Dans ton chunk, tu utilise [+tvdate_debut+] | [+tvduree+] etc.

            La tu aura l’affichage de tes TV
              Marc
              I&#39;m French... Sorry for my bad English, I use &#39; Google Translator&#39; or other... but that remains that tools wink
              • 9583
              • 25 Posts
              Okay, I’m experimenting today, and I’ve run into a snag trying to implement a TV icon; getting a parse error here:
              MODx encountered the following error while attempting to parse the requested resource:
              « PHP Parse Error »
               
              PHP error debug
               Error:  Invalid argument supplied for foreach()  
               Error type/ Nr.:  Warning - 2  
               File:  /home/.ZZZZZZ/ZZZZZZZ/ZZZZZZZZ.org/assets/snippets/newslisting/functions.php  
               Line:  72  
               Line 72 source:  foreach ($tvs as $name=> $object) {    
               

              I’ve uploaded the latest snipped w/ no changes.  Here’s my tpl chunk:
              				
              <div class="Item">		
                 [+tvsectionicon+]<h1 class="ItemTitle">[+title+]</h1>		
              	<div class="ItemBody">[+summary+]
              	</div>
              	<div class="ItemMoreLink">[+link+]
              	</div>
              	<div class="ItemFooter><span class="ItemAuthor">Posted by [+author+]</span> on <span class="ItemDate">[+link+][+date+]</span> 					
                      </div>
              </div>
              
              

              ...and I’m calling it from the page as follows:
              [!NewsListing?startID=18&summarize=20&hidefolders=1&multilevel=1&truncLen=50&tpl=nl-item-tpl!]


              I’ve got the TV set up as an image widget, template access set to the template, and document permissions set for all.  The default value is set to @INHERIT.  The very root folder has an image value set, and 2 of my test sub-folders have images set, and everything else shows up as @INHERIT, like I’d expect.

              Removing the [+tvsectionicon+] allows the snippet to work.

              Removing the default value of @INHERIT doesn’t help.

              So I guess now I’m confused.  :P  This is my first foray into TVs, so I might be missing something, but it all looks correct after picking through the docs and the examples.

              Any pointers as to where I can look next for something I screwed up?

              EDIT: BTW, the TV is actually named "sectionicon" and not "tvsectionicon" smiley
                • 6726
                • 7,075 Posts
                Marc, in english please... placeholder DO have to be prefixed by "tv" it’s not a mistake you can’t use [+duree+] or [+date_debut+]...

                My problem has nothing to do with the template not working, it works allright.
                The problem was the use of the &filter parameter which is another problem entirely...

                Quote from: Marc at Jan 11, 2006, 11:32 AM

                David,

                Les noms des TV doivent être ’date_debut’, ’duree’, etc.
                Dans ton chunk, tu utilise [+tvdate_debut+] | [+tvduree+] etc.

                La tu aura l’affichage de tes TV


                  .: COO - Commerce Guys - Community Driven Innovation :.


                  MODx est l&#39;outil id
                  • 6726
                  • 7,075 Posts
                  Snippets do not include <? and ?> it’s automatically added.

                  That’s why it’s distributed as text files, I guess. Now if Mark edits his files with an editor supporting syntax highlighting (more readable), he might have saved it with a php extension. Just copy and paste the content of the file in the manager under the newslisting snippet.

                  It should work as usual.
                  Snippet are php files, but without the <? and ?>

                  Quote from: edge at Jan 11, 2006, 11:21 AM

                  Mark, For the sake of clarity

                  We have to overwrite the contents of NewsListing with the contents of the file snippet.newslisting.6.2.txt, however the download file is called snippet.newslisting.6.2.php.

                  Can you confirm if I just extract the code on the page and put this is my newslisting snippet or any new snippet I create

                  many thanks
                    .: COO - Commerce Guys - Community Driven Innovation :.


                    MODx est l&#39;outil id
                    • 8461
                    • 205 Posts
                    As I thought, thanks for the clarification David
                      • 32847
                      • 171 Posts
                      I suppose filtering become too difficult for me.
                      I would like to use it but I need exemple.
                      May be latter in the documentation