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
    This should do the trick as courseID.extender.inc.php: (Note that this is untested)
    <?php
    
    $filters["custom"]["courseID"] = array("courseid","courseIdFilter"); 
    
    if (!function_exists("courseIdFilter")) {
    	function courseIdFilter($resource) {
    		if ($resource['courseid'] <= 999 && $resource['courseid'] >= 600) {
    			return 1;
    		} else {
    			return 0;
    		}
    	}
    }
    ?>
    

    Add &extender=`courseID` to your call and it should work.
      • 10896
      • 76 Posts
      Thank you so much Mark!

      That worked.
        • 10896
        • 76 Posts
        Ok. I’m trying my hand at creating my own extender. Something isn’t working however.

        Ditto call
        [!Ditto? &parents=`47,48,49,50,51,52` &sortBy=`pagetitle` &sortDir=`ASC` &display=`all` &extenders=`lodging` &tpl=`mem_content_tpl` &tplAlt=`mem_content_tplAlt` !]


        Extenderfile lodging.extender.inc.php
        <?php
        
        // lodging.extender.inc.php
        
        
        $filters["custom"]["lodging"] = array("mem_category","lodgingFilter");
        
        if (!function_exists("lodgingFilter")) {
        	function lodgingFilter($resource) {
        		if (strpos($resource['mem_category'], 'motels') || strpos($resource['mem_category'], 'bed & breakfast')) {
        			return 1;
        		} else {
        			return 0;
        		}
        	}
        }
        ?>
        


        What I want is for the filter to return the result if the string ’motels’ or ’bed & breakfast’ is in the template variable (text type) mem_category. But it isn’t working. Can someone spot my mistake(s) and help me out?

        Thanks!
          • 18397
          • 3,250 Posts
          Is it not filtering correctly or returning a PHP error?
            • 10896
            • 76 Posts
            Evo

            You’re probably going to have to use an extender to accomplish this. See the sample code above -- because I was trying to get the same kind of results: the middle portion of an ordered set. You’ll have to include the extender parameter in your ditto call and do the filtering with PHP code in the corresponding extender file. BTW - it will only help to upgrade your Ditto to version 2.1 (the latest one offered in the downloads section)

              • 9250
              • 6 Posts
              Quote from: gl330k at Mar 13, 2008, 06:48 AM

              You’re probably going to have to use an extender to accomplish this. See the sample code above -- because I was trying to get the same kind of results: the middle portion of an ordered set. You’ll have to include the extender parameter in your ditto call and do the filtering with PHP code in the corresponding extender file. BTW - it will only help to upgrade your Ditto to version 2.1 (the latest one offered in the downloads section)

              okay, thats right. i’ve read the posts above, but: i will try to do an ajax search. can i use the variables which has been send in the extender? like $_GET/$_POST or something?
              i’ve already tried to work the problem out with tvExplorer, but.. i think, there have to be some more features and i get only errors (don’t know why)
                • 11975
                • 2,542 Posts
                Hi,

                if you need help about tvexplorer, do not hesitate to ask quetions about how to use it.

                :-)
                  Made with MODx : [url=http://www.copadel.com]copadel, fruits et l