We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 1932
    • 137 Posts
    I could add the ability to set a custom placeholder, it would have to be available on all levels of the feed. It wouldn’t be a problem really, I’m just trying to figure out the best way to implement it. Should I allow for multiple placeholders to be set?

    The other option would be to add the id to the feed’s html container and place the snippet call within said container.
      • 30128
      • 78 Posts
      Quote from: ApoXX at Mar 12, 2007, 04:25 PM

      I could add the ability to set a custom placeholder, it would have to be available on all levels of the feed. It wouldn’t be a problem really, I’m just trying to figure out the best way to implement it. Should I allow for multiple placeholders to be set?
      For now I myself only need one, but if you want to power it up you could of course take in tuples as arguments, something like this:
      [!FeedX? &url=`http://wdr1.com/blog/calvin_and_hobbes.rdf` &preset=`rdf` &userArg=`(placholder,string),(placholder2,string2)` !]
      or whatever format works, giving us the power to name the placeholders and assign them custom variables. But as I said, I don’t need that at this stage.

      Quote from: ApoXX at Mar 12, 2007, 04:25 PM

      The other option would be to add the id to the feed’s html container and place the snippet call within said container.
      That doesn’t work for me, since I’m displaying the items for a feed in different ways so that some items have their own template, AND I create links inside these templates which contains javascript that needs the div as an argument. So wrapping the snippet-calls inside divs don’t do the trick.

      It would be awesome if you added the custom placeholder ability.
        • 1932
        • 137 Posts
        Okay, I have added custom placeholder support:

        The following would set [+JSID+] to the value test, making it available to any of the called templates or chunks. Multiple placeholders can be separated by colons.

        &userPh=`JSID->test`
          • 30128
          • 78 Posts
          Fabulous! I don’t immediately get it to work, but that might very well just be me. Is it added to debug yet? I don’t see my custom placeholders there either, but maybe that’s not supposed to happen either. So, the name I set for the placeholders don’t show up in debug, and when I use the placeholders in the templates I only get nothing as output.

          I’ve double-checked that I have updated both the code and the snippet, and made sure I use back-ticks everywhere.
            • 1932
            • 137 Posts
            It definitely works for me, can you perhaps show me your snippet call and the placeholder in your template? Remember, placeholders are case-sensitive.

            Edit: Added &userPh output to debug console.
              • 30128
              • 78 Posts
              Nah it’s probably just me. Here’s a typical call:

              [!FeedX? &url=`http://atheos.de/funnies/nemi.rdf` &preset=`comicrdf` &debug=`0` &userPh=`JSID->nemi` !] 


              Usually I edit it with QuickEdit, in which case the call looks like this:
              [!FeedX? &url=`http://atheos.de/funnies/nemi.rdf` &preset=`comicrdf` &debug=`1` &userPh=`JSID->nemi` !]
              


              But (at least as long as it’s not working) currently I edit it in HTML mode.

              I’ve downloaded the code and snippet again but it still doesn’t show up in the debugger, so I guess I have something else interfering. This particular template use PHx modifiers on the placeholders, but I’ve also tried it on templates that use no PHx. I’ve also tried &usePhx=`1` and &usePhx=`0` to no avail.

              The page template itself doesn’t do anything special, and everything else FeedX works fine. I really shouldn’t write a long post like this about the problem though since most probably it is something minor and stupid I do wrong.
                • 1932
                • 137 Posts
                It looks like QuickEdit/TinyMCE is changing the > to > which is causing the placeholder to be set incorrectly. I should be able to fix that easily enough but try disabling the rich text editor to see if that is indeed the source of your problems.

                My working call looked like:

                [!FeedX? &url=`http://atheos.de/funnies/nemi.rdf` &preset=`rdf` &debug=`1` &userPh=`JSID->nemi`!] 


                With the placeholder [+JSID+] within the template file.

                It should be visible in the debug console under: Info->User Placeholders
                If it’s not showing up you may need to clear your download cache and re-download the zip file.
                  • 30128
                  • 78 Posts
                  Heh, it actually WAS the rich text. I had come to believe that when I turned on HTML mode in QE it disabled rich text (and I also thought I tried turning off rich text in content manager).

                  Now it works and it’s just sooo cool smiley Thx a lot!

                  All the rest of FeedX features works even if you let QE chew on all the special HTML characters.
                    • 1932
                    • 137 Posts
                    Cool, I’ve updated the snippet code in the first post. It should allow FeedX to be used with the RTE.
                      • 14050
                      • 788 Posts
                      Brian,

                      This is a little beyond me, but I was still looking at using FeedX to make GoogleEvents obsolete, and was wondering if there was any way to take the Google Calendar feed to fill a custom calendar script.

                      The calendar needs to be initiated:

                      	include_once('assets/snippets/GoogleEvents/source/activecalendar.php');
                      	//For the calendar script
                      	//Variables for Calendar
                      	$myurl='?id='.$modx->documentIdentifier; // the links url is this page
                      	$yearID=false; // init false to display current year
                      	$monthID=false; // init false to display current month
                      	$dayID=false; // init false to display current day
                      	extract($_GET); // get the new values (if any) of $yearID,$monthID,$dayID
                      	$arrowBack="<img src=\"assets/snippets/GoogleEvents/data/img/back.png\" alt=\"<<\" />"; // use png arrow back
                      	$arrowForw="<img src=\"assets/snippets/GoogleEvents/data/img/forward.png\" alt=\">>\" />"; // use png arrow forward
                      	$cal = new activeCalendar($yearID,$monthID,$dayID);


                      Then for each "Entry" I need to call active calendar with the following information:

                      $cal->setEvent($event['startYear'],$event['startMonthCal'],$event['startDay'],"event",$event['url']);


                      I know I could parse that all out using phX.

                      And then at the end I need to print the calendar using:

                      //outPutCalendar($fullMonths, $shortMonths,$mDays, $arrangedEvents);
                      			$cal->setDayNames($dayNameSize);
                      			$cal->setMonthNames($monthNames);
                      			$cal->setFirstWeekDay($firstDay);
                      			$cal->enableMonthNav($myurl,$arrowBack,$arrowForw); // enables navigation controls
                      			print $cal->showMonth();


                      This is just the class I use for GoogleEvents. If you know of an easier way than using this PHP Script, that would work also.
                        Jesse R.
                        Consider trying something new and extraordinary.
                        Illinois Wine

                        Have you considered donating to MODx lately?
                        Donate now. Every contribution helps.