[Developers] sandbox.freebase.com weekly update

Kirsten Jones synedra at gmail.com
Tue Jul 10 16:31:25 UTC 2007


Hi all,

I'm trying to create an MJT implementation similar to the FMDb, but  
I'm running into an issue where it's not behaving correctly for me.

I have this, which probably looks suspiciously like the same code  
from FMDb:

<div mjt.task="image">
	mjt.mqlread({
		"id":mjt.urlquery.game,
		"type":[{}],
		"name":null,
		"/common/topic/image":({
			"id":null,
			"timestamp":null,
			"optional":true,
			"limit":1
		})
	})
</div>

<img alt="image" src="#" mjt.src="${mjt.imgurl(image.result['/common/ 
topic/image'].id, 265, 1000)}" />

For games with an image, this causes the image to appear, but I get  
an error:

error applying tfunc main() [object Object]
     TypeError: image.result has no properties
             										"limit":1
            									})
            								})
            							));
            __m[__n++]=__ts[52];
---174-->  if (image.result['/common/topic/image'].length) {
            __m[__n++]=__ts[53];
            __m[__n++]=(mjt.imgurl(image.result['/common/topic/ 
image'].id, 265, 1000));
            __m[__n++]=__ts[54];
            }

For games with no image, I just get the error, no image, and it  
doesn't display the rest of the stuff.

If I add the logic of <div mjt.if="image.result['/common/topic/ 
image'].length"> I don't get the picture ever, but I still get the  
error.

I assume I'm missing something obvious.  Help?

TIA,

Kirsten



More information about the Developers mailing list