How to show contentSnippet in AJAX Feed horizontal version

31 views
Skip to first unread message

akulavolk

unread,
Jul 28, 2008, 7:37:32 PM7/28/08
to Google AJAX API
I ran through the AJAX Feed API feed control wizard to create a
horizontal version, but am trying to figure out how to customize the
display of the feed. As a for-instance, just use the default code
generated here:

http://www.google.com/uds/solutions/wizards/dynamicfeed.html

Rather than the published time that's appearing, I'd like to have a
short summary of the article text appear next to the name. I'm
guessing this is using contentSnippet instead of publishedDate or
something. Any ideas of how to do this?

Second question: once I do this, how can I customize the number of
words or characters shown by contentSnippet?

Thanks in advance...

akulavolk

unread,
Jul 28, 2008, 7:02:49 PM7/28/08
to Google AJAX API
Message has been deleted

jgeerdes [AJAX APIs "Guru"]

unread,
Jul 28, 2008, 9:13:46 PM7/28/08
to Google AJAX API
First question: Try these two lines of CSS:

.gfg-horizontal-root .gfg-entry .gf-result .gf-
relativePublishedDate{display:none;}
.gfg-horizontal-root .gfg-entry .gf-result .gf-snippet{display:block;}

That should shut off the date and turn on the snippet for you.

Second question: The only way to customize the length of the content
snippet is to override chunks of the original code, probably even to
the point where you would want to consider writing your own control.
Shortening the snippet is no big deal; it's just a matter of taking
the entry's contentSnippet attribute and substringing it. To lengthen
it, though, you'll have to get the mixed results (i.e., XML and JSON)
and parse out the content of the appropriate element.

Jeremy R. Geerdes
Effective website design & development
Des Moines, IA

For more information or a project quote:
http://jgeerdes.home.mchsi.com
jgee...@mchsi.com

If you're in the Des Moines, IA, area, check out Debra Heights
Wesleyan Church!
Reply all
Reply to author
Forward
0 new messages