Google Gadgets (4):定义 Gadget 属性

XML 中的 <ModulePrefs> 标签里的属性指定了这个 Gadget 的属性,比如标题、作者、联系方式,等等。我们来看下面的例子:

 
 
< Module >
  
< ModulePrefs  title ="测试用 Gadget "
    title_url
="http://biggates.cnblogs.com/"
    height
="200"
    author
="biggates"
    author_email
="abc@def.com" />
  
< Content  ... >
     ...这里是内容... 
  
</ Content >
</ Module >

这些属性是无法被用户所更改的。
下面列出了这些属性的值:
 

AttributeDescription
title Optional string that provides the title of the gadget. This title is displayed in the gadget title bar on iGoogle. If this string contains user preference substitution variables and you are planning to submit your gadget to the content directory, you should also provide a directory_title for directory display.
directory_title Optional string that provides the title that should be displayed for your gadget in the content directory. Should contain only the literal text to be displayed, not user preference substitution variables. This is because the content directory displays a static view of your gadget, and therefore can't perform the necessary substitution to produce a reasonable title. For example, if your gadget's title is "Friends for __UP_name__", the directory is not able to perform the substitution to provide a reasonable value for " __UP_name__". So you might set your directory_title to be simply "Friends".
title_url Optional string that provides a URL that the gadget title links to. For example, you could link the title to a webpage related to the gadget.
description Optional string that describes the gadget.
author Optional string that lists the author of the gadget.
author_email Optional string that provides the gadget author's email address. You can use any email system, but you should not use a personal email address because of spam. One approach is to use an email address of the form helensmith.feedback+coolgadget@gmail.com in your gadget spec.

Gmail drops everything after the plus sign (+), so this email address is interpreted as helensmith.feedback@gmail.com.

You can create a Gmail account here.
author_affiliation Optional string such as "Google" that indicates the author's affiliation. This attribute is required for gadgets that are included in the content directory.
author_location The author's geographical location, such as "Mountain View , CA, USA ".
screenshot Optional string that gives the URL of a gadget screenshot. This must be an image on a public web site that is not blocked by robots.txt. PNG is the preferred format, though GIF and JPG are also acceptable. Gadget screenshots should be 280 pixels wide. The height of the screenshot should be the "natural" height of the gadget when it's in use. For more discussion of screenshot guidelines, see Publishing to the Content Directory.
thumbnailOptional string that gives the URL of a gadget thumbnail. This must be an image on a public web site that is not blocked by robots.txt. PNG is the preferred format, though GIF and JPG are also acceptable. Gadget thumbnails should be 120x60 pixels. For more discussion of thumbnail guidelines, see Publishing to the Content Directory.
height Optional positive integer that specifies the height of the area in which the gadget runs. The default height is 200.
width Optional positive integer that specifies the width of the area in which the gadget runs. This setting only applies to syndicated gadgets. The default width is 320.
scaling Optional boolean that specifies whether the aspect ratio (height-to-width ratio) of the gadget is maintained when the browser is resized. Gadgets that can automatically scale vertically should set this to true, but gadgets which have a fixed height should set this to false. The default is true.
scrolling Optional boolean that provides vertical and/or horizontal scrollbars if the content exceeds the space provided. If false, then the content is clipped to the height and width provided (not that width is not configurable). The default is false.
singleton Optional boolean that specifies whether users can add a gadget multiple times from a directory. The default is true, meaning that by default, gadgets can only be added once. Directories can handle this attribute however they choose. For example, the content directory handles singleton="true" by graying out and displaying the text "Added" for gadgets that have already been added. Note that changes to this attribute may not be picked up by directories right away.

This attribute doesn't prevent users from adding gadgets multiple times through the developer gadget or Add by URL. Consequently, you still need to write your gadget to support multiple instances.
author_photoFor the authors page, a URL to a photo (70x100 PNG format preferred, but JPG/GIF are also supported).
author_aboutmeFor the authors page, a statement about yourself (try to keep to ~500 characters).
author_linkFor the authors page, a link to your website, blog, etc.
author_quoteFor the authors page, a quote you'd like to include (try to keep to ~300 characters).

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值