Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Sebastian Dammark 583 posts 1407 karma points
    Oct 04, 2012 @ 20:36
    Sebastian Dammark
    0

    Suddenly GetMediaByUrlName stopped working

    I have a media where id is 2041 and urlName is s5090-1459.
    Suddenly GetMediaByUrlName stopped working and doesn't give any output.

    It worked at 16:00 but now $media is just empty.

    GetMedia works just as it should.

    <Image id="2041" version="354a6a34-173b-496e-b72f-ad86703befd6" parentID="1046" level="2" writerID="0" nodeType="1032" template="0" sortOrder="0" createDate="2012-10-02T08:48:43" updateDate="2012-10-02T08:48:43" nodeName="S5090-1459" urlName="s5090-1459" writerName="admin" nodeTypeAlias="Image" path="-1,1046,2041">
    
    <xsl:template match="ContentProduct">
        <xsl:variable name="media" select="umedia:GetMediaByUrlName('s5090-1459')/umbracoFile" />
        <textarea>
            <xsl:copy-of select="$media" />
            <xsl:comment />
        </textarea>
        <textarea>
            <xsl:copy-of select="umb:GetMedia(2041,0)/umbracoFile" />
        </textarea>
    </xsl:template>

     

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Oct 04, 2012 @ 20:39
    Lee Kelleher
    0

    Is this related to a v4 -> v5 upgrade?  or did it just stop working?

  • Sebastian Dammark 583 posts 1407 karma points
    Oct 04, 2012 @ 20:41
    Sebastian Dammark
    0

    It isn't related to the upgrade.
    I actually upgraded in the hopes that it would be fixed :)

    It stopped working under v4 and upgrading to v5 didn't help.

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Oct 04, 2012 @ 20:45
    Lee Kelleher
    0

    Trying to think why it would stop working.  Looking at your XSLT, it is possible for 'GetMediaByUrlName' to return a collection of media nodes - if you have multiple media with the same name?

    Try changing the variable's XPath slightly...

    <xsl:variable name="media" select="umedia:GetMediaByUrlName('s5090-1459')[0]/umbracoFile" />

    Cheers, Lee.

  • Sebastian Dammark 583 posts 1407 karma points
    Oct 04, 2012 @ 20:57
    Sebastian Dammark
    0

    Nope.  $media is still empty

    You can see the complete XSLT here:
    http://dl.dropbox.com/u/145581/productcategory.xslt ;

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Oct 04, 2012 @ 21:06
    Lee Kelleher
    0

    Doh! Sorry... I'm thinking in C# again - zero-based indexes.  #h5is  Try changing it to "[1]".

  • Sebastian Dammark 583 posts 1407 karma points
    Oct 04, 2012 @ 21:32
    Sebastian Dammark
    0

    No.

    I've updated the XSLT with a static urlName that I know for sure only exists once. :)  Just to be sure.

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Oct 04, 2012 @ 21:34
    Lee Kelleher
    0

    Try...

    <xsl:copy-of select="umedia:GetMediaByUrlName('s1011-0000')" />

    Obviously, this is all guess-work from me.  Still seems weird that the function suddenly stopped working.

  • Sebastian Dammark 583 posts 1407 karma points
    Oct 04, 2012 @ 21:40
    Sebastian Dammark
    0

    Didn't have any effect.

    I can give you access to the solution if that would help you.

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Oct 04, 2012 @ 21:47
    Lee Kelleher
    0

    Can't help tonight - sorry ... will have a think about what the problem might be.

    Last guess for this evening... try re-saving the media node (in the back-office) for "s1011-0000", then try the XSLT again ... gut feeling is that the "cmsContentXml" table in the database has been cleared out (for whatever reason).

    Cheers, Lee.

  • Sebastian Dammark 583 posts 1407 karma points
    Oct 04, 2012 @ 21:49
    Sebastian Dammark
    0

    I'll try that ... thanx.

  • Sebastian Dammark 583 posts 1407 karma points
    Oct 04, 2012 @ 22:30
    Sebastian Dammark
    0

    Naaa ... that didn't work either.

    This is quite odd.

  • Anders Stentebjerg 58 posts 234 karma points
    Jan 17, 2013 @ 08:44
    Anders Stentebjerg
    0

    Hi Lee,
    Now we got the problem again. Is there any changes from uComponents 5.0 -> 5.3? 

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Jan 17, 2013 @ 10:32
    Lee Kelleher
    0

    Hi Anders,

    Just checked our repo - there were no changes to that method since v3.x.  Although a underlying call is made to the core (uQuery) ... I'll dig a little deeper, see if there is anything strange going on.

    Which version of Umbraco are you using?

    Cheers, Lee.

  • Anders Stentebjerg 58 posts 234 karma points
    Jan 17, 2013 @ 11:11
    Anders Stentebjerg
    0

    Thanks Lee,
    I'm running Umbraco v 4.11.3 and uComponents 5.3

    Cheers

  • Anders Stentebjerg 58 posts 234 karma points
    Jan 17, 2013 @ 11:19
    Anders Stentebjerg
    0

    FYI: Now all images are back. Very strange …

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Jan 17, 2013 @ 13:37
    Lee Kelleher
    0

    Strange indeed!  The GetMediaByUrlName queries the XML for all the media items ... it could mean that the cmsContentXml tables were cleared in the database? (not sure how or why, and don't expect you to know ... just thinking out loud)

    Do let me know if you find any errors, etc - anything that can help figure out how to pinpoint the issue.

    Cheers, Lee.

Please Sign in or register to post replies

Write your reply to:

Draft