Google Gadgets (4):定義 Gadget 屬性

來源:互聯網
上載者:User

XML 中的 <ModulePrefs> 標籤裡的屬性指定了這個 Gadget 的屬性,比如標題、作者、連絡方式,等等。我們來看下面的例子:

 1<Module>
 2  <ModulePrefs title="測試用 Gadget "
 3    title_url="http://biggates.cnblogs.com/"
 4    height="200"
 5    author="biggates"
 6    author_email="abc@def.com"/>
 7  <Content >
 8     這裡是內容 
 9  </Content>
10</Module>

這些屬性是無法被使用者所更改的。
下面列出了這些屬性的值:
 

Attribute Description
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.
thumbnail Optional 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_photo For the authors page, a URL to a photo (70x100 PNG format preferred, but JPG/GIF are also supported).
author_aboutme For the authors page, a statement about yourself (try to keep to ~500 characters).
author_link For the authors page, a link to your website, blog, etc.
author_quote For the authors page, a quote you'd like to include (try to keep to ~300 characters).

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.