We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 1932
    • 137 Posts
    If you have the just the call {{ITEM->restItems}} and &firstElement defined, it will replace the fist element matching ITEM with firstItem rather than restItems.

    I think with quotes you need to escape them with backslashes?

    <a href="" onclick="document.getElementById('stripimage').innerHTML = '<img src=\"[+ENCLOSURE.URL+]\" />'">


    Maybe you could provide the output source as an example.
      • 30128
      • 78 Posts
      Ok here we go. If I use backslashes like this:
      <a href="" onclick="document.getElementById('stripimage').innerHTML = '<b>[+TITLE+]</b><br />
      <a href=\"[+LINK+]\"><img src=\"[+ENCLOSURE.URL+]\" alt=\"[+TITLE+],posted on [+PUBDATE+]\" /></a><br />
      '">[+TITLE+]</a>
      , I get this output:
      <a href="" onclick="document.getElementById('stripimage').innerHTML = '<b>Comic for 04 Mar 2007</b><br />
      <a href=\"http://www.dilbert.com/comics/dilbert/archive/dilbert-20070304.html\"><img src=\"http://www.dilbert.com/comics/dilbert/archive/images/dilbert2007030349094.jpg\" alt=\"Comic for 04 Mar 2007,posted on Sun, 04 Mar 2007 00:01:00 -0500\" /></a><br />
      '">Comic for 04 Mar 2007</a>

      Which is plain, broken HTML.

      Using the code for double quotes instead, &quot;, like this:
      <a href="" onclick="document.getElementById('stripimage').innerHTML = '<b>[+TITLE+]</b><br />
      <a href="[+LINK+]"><img src="[+ENCLOSURE.URL+]" alt="[+TITLE+],posted on [+PUBDATE+]" /></a><br />
      '">[+TITLE+]</a>
      gives this output:
      <a href="" id="striplinks" onclick="document.getElementById('stripimage').innerHTML = '<b>Comic for 04 Mar 2007</b><br />
      <a href="http://www.dilbert.com/comics/dilbert/archive/dilbert-20070304.html"><img src="http://www.dilbert.com/comics/dilbert/archive/images/dilbert2007030349094.jpg" alt="Comic for 04 Mar 2007,posted on Sun, 04 Mar 2007 00:01:00 -0500" /></a><br />
      '">Comic for 04 Mar 2007</a>

      ..and this doesn’t work either.

      It seems like neither HTML nor Javascript wants to take responsibility for parsing the characters here, so javascript don’t parse the backslashes because it considers it html code, and html don’t parse the &quote; because it consider it to be part of the javascript code. Or something like that.

      I’m sure there’s a way around it and it’s not a major obstacle so I probably shouldn’t use more space on this thread for the subject. But if someone out there know the solution, please speak up smiley

        • 30128
        • 78 Posts
        Nevermind, I found a nice script here: http://www.brothercake.com/site/resources/scripts/transitions/ that did the trick - it takes an element-ID and a new image, and swap-fade them.

        New problem though: I’ll have a ton of FeedX calls on the same page, for all the different comic strips. Thus I’ll need a different element-ID for the image-container of each feed.

        This could have been something like the first letters of the feed title, but then I’d need someting like {+FEEDTITLE+] since the element ID will be set in the channel template, but the javascript call is made in the restItems template. Currently I can only get [+TITLE+], which is not the same in channel and restItems.
          • 30128
          • 78 Posts
          Reading RDF feeds

          There seem to be some placeholders missing when reading feeds like this: http://atheos.de/funnies/nemi.rdf.

          I’ve displayed the content of every possible placeholders (from &tplBuilder=`1`), and none of them contains the link to the actual image, however when reading the feed in a feed reader, the image is shown.

          Here are the placeholders for this specific feed:
          [+RDF|RDF.XMLNS|RDF+]
          [+RDF|RDF.XMLNS|DC+]
          [+RDF|RDF.XMLNS+]
          {{RDF|RDF->...}} 
               {{CHANNEL->...}} 
                    [+TITLE+]
                    [+LINK+]
                    [+DESCRIPTION+]
               {{IMAGE->...}} 
                    [+TITLE+]
                    [+URL+]
                    [+LINK+]
                    [+WIDTH+]
                    [+HEIGHT+]
               {{ITEM->...}} 
                    [+TITLE+]
                    [+LINK+]
                    [+PUBDATE+]
                    [+DESCRIPTION+]


          I miss something like
                    [+ENCLOSURE.URL+]
                    [+ENCLOSURE.LENGTH+]
                    [+ENCLOSURE.TYPE+]
          under ITEM, which I’ll find for a normal RSS feed and that contains the actual image.

          p.s: IMAGE is just a logo for the feed and has only one occurence, it is ITEM that contains the actual data and this feed has 10 of them.
            • 1932
            • 137 Posts
            @tjalve:

            Yes, the RDF standard does not provide the enclosure elements. The image in the feed you provided (including html) is located in the [+DESCRIPTION+] placeholder. The placeholder includes html entities for the < and > so you would have to convert those using PHx (although I could have the snippet do it automatically if that seems to be the standard for other feed readers??)...

            For phx you would create a new snippet called: phx:entitydecode
            <?php
            return html_entity_decode($output);
            ?>
            


            and in your chunks use [+DESCRIPTION:entitydecode+]

            I also could show you how to write a modifier to extract the image URL from the html.
              • 30128
              • 78 Posts
              PHx is fine, then we have full control. It was about time I installed it anyway smiley I tested that it worked by using [+TITLE:lcase+] which correctly returned the title in lowercase only.

              When I tried to use :entitydecode (after creating the snippet) nothing happened. I further tried :esc , :htmlent and :notags.

              :esc for example, returned me only &gt;, the character code for >.

              If I use no modifier that is also what I get: The > sign only. It seems I lack the content of [+DESCRIPTION+] already, parsed away somewhere else.

              I use MODx 0.9.5, Apache 1.3, PHP 5.2.1 and the latest PHx and FeedX.
                • 14050
                • 788 Posts
                Quote from: tjalve at Mar 06, 2007, 05:01 AM

                PHx is fine, then we have full control. It was about time I installed it anyway smiley I tested that it worked by using [+TITLE:lcase+] which correctly returned the title in lowercase only.

                When I tried to use :entitydecode (after creating the snippet) nothing happened. I further tried :esc , :htmlent and :notags.

                :esc for example, returned me only &gt;, the character code for >.

                If I use no modifier that is also what I get: The > sign only. It seems I lack the content of [+DESCRIPTION+] already, parsed away somewhere else.

                I use MODx 0.9.5, Apache 1.3, PHP 5.2.1 and the latest PHx and FeedX.

                I seem to only get the > character only when the feed contains html entities.

                Here is the call:

                [!FeedX? &cacheTime=`60` &url=`http://www.google.com/calendar/feeds/[email protected]/public/full/|xq|orderby|xe|starttime|xa|singleevents|xe|true` &tplPreset=`gcal`!]


                Here is the URL you can see it at (Look at description of first entry):

                http://www.cmssandbox.com/MODx095/index.php?id=57

                In the description for the Google Calendar feed, I placed this code in "<a href="http://www.google.com">Google</a>"

                FireFox’s built in feed reader serves up this:

                "Where you learn to code the most important program in all of computer science! <a href="http://www.google.com">Google</a>"

                SimplePie Demo serves up the same as FireFox.

                The raw source of the feed for that element (<content>) looks like this:

                <content type='text'>Where you learn to code the most important program in all of computer science! <a href="http://www.google.com">Google</a></content>


                  Jesse R.
                  Consider trying something new and extraordinary.
                  Illinois Wine

                  Have you considered donating to MODx lately?
                  Donate now. Every contribution helps.
                  • 30128
                  • 78 Posts
                  Yes, and this is the case: the image I need is enclosed in some html bracket I don’t manage to strip away.

                  And dude, how and where do you use the <content type=’txt’> tag? I’ve been longing for something that can give me the raw output. I’ve tried escaping, PHx, php echo and more.
                    • 14050
                    • 788 Posts
                    The raw output is from looking at the source of the feed address in Firefox.
                      Jesse R.
                      Consider trying something new and extraordinary.
                      Illinois Wine

                      Have you considered donating to MODx lately?
                      Donate now. Every contribution helps.
                      • 1932
                      • 137 Posts
                      I found the problem although there may still be some issues when using external entities.

                      The code/download in the first past has been updated, please try it out and let me know how it works. The entity decode is no longer necessary since PHP automatically resolves these entities (&gt; &lt;, &nbsp;, etc).

                      Also, I added an RDF preset which is slightly different from the RSS one.