rss_gen_091 (public)

 rss_gen_091 [ -channel_title channel_title ] \
    [ -channel_link channel_link ] \
    [ -channel_description channel_description ] \
    [ -channel_language channel_language ] \
    [ -channel_copyright channel_copyright ] \
    [ -channel_managingEditor channel_managingEditor ] \
    [ -channel_webMaster channel_webMaster ] \
    [ -channel_rating channel_rating ] \
    [ -channel_pubDate channel_pubDate ] \
    [ -channel_lastBuildDate channel_lastBuildDate ] \
    [ -channel_skipDays channel_skipDays ] \
    [ -channel_skipHours channel_skipHours ] [ -image image ] \
    [ -items items ]

Defined in packages/rss-support/tcl/rss-generation-procs.tcl

generate an rss 0.91 xml feed

Switches:
-channel_title (optional)
-channel_link (optional)
-channel_description (optional)
-channel_language (optional, defaults to "en-us")
-channel_copyright (optional)
-channel_managingEditor (optional)
-channel_webMaster (optional)
-channel_rating (optional)
-channel_pubDate (optional)
-channel_lastBuildDate (optional)
-channel_skipDays (optional)
-channel_skipHours (optional)
-image (optional)
-items (optional)

Partial Call Graph (max 5 caller/called nodes):
%3 rss_gen rss_gen (public) rss_gen_091 rss_gen_091 rss_gen->rss_gen_091 acs_root_dir acs_root_dir (public) rss_gen_091->acs_root_dir ad_url ad_url (public) rss_gen_091->ad_url rss_package_url rss_package_url (public) rss_gen_091->rss_package_url

Testcases:
No testcase defined.
Source code:

    set rss ""

    if {$channel_title eq ""} {
        error "argument channel_title not provided"
    }
    if {$channel_link eq ""} {
        error "argument channel_link not provided"
    }
    if {$channel_description eq ""} {
        error "argument channel_description not provided"
    }

    append rss "<rss version=\"0.91\">\n"
    append rss "<channel>\n"

    append rss "<title>"
    append rss [ns_quotehtml $channel_title]
    append rss "</title>\n"

    append rss "<link>"
    append rss [ns_quotehtml $channel_link]
    append rss "</link>\n"

    append rss "<description>"
    append rss [ns_quotehtml $channel_description]
    append rss "</description>\n"

    append rss "<language>"
    append rss [ns_quotehtml $channel_language]
    append rss "</language>\n"

    if {$channel_copyright ne ""} {
        append rss "<copyright>"
        append rss [ns_quotehtml $channel_copyright]
        append rss "</copyright>\n"
    }

    if {$channel_managingEditor ne ""} {
        append rss "<managingEditor>"
        append rss [ns_quotehtml $channel_managingEditor]
        append rss "</managingEditor>\n"
    }

    if {$channel_webMaster ne ""} {
        append rss "<webMaster>"
        append rss [ns_quotehtml $channel_webMaster]
        append rss "</webMaster>\n"
    }

    if {$channel_rating ne ""} {
        append rss "<rating>"
        append rss [ns_quotehtml $channel_rating]
        append rss "</rating>\n"
    }

    if {$channel_pubDate ne ""} {
        append rss "<pubDate>"
        append rss [ns_quotehtml $channel_pubDate]
        append rss "</pubDate>\n"
    }

    if {$channel_lastBuildDate ne ""} {
        append rss "<lastBuildDate>"
        append rss [ns_quotehtml $channel_lastBuildDate]
        append rss "</lastBuildDate>\n"
    }

    append rss "<docs>"
    append rss "http://backend.userland.com/stories/rss091"
    append rss "</docs>\n"

    if {$channel_skipDays ne ""} {
        append rss "<skipDays>"
        append rss [ns_quotehtml $channel_skipDays]
        append rss "</skipDays>\n"
    }

    if {$channel_skipHours ne ""} {
        append rss "<skipHours>"
        append rss [ns_quotehtml $channel_skipHours]
        append rss "</skipHours>\n"
    }

    if {$image eq ""} {
    set base     images/openacs_logo_rss.gif
        set url      [ad_url][rss_package_url]$base
        set title    $channel_title
        set link     $channel_link
        set size     [ns_gifsize [acs_root_dir]/packages/rss-support/www/$base]

        set image [list                                           url $url                                          title $title                                      link $link                                        width [lindex $size 0]                            height [lindex $size 1]]
    }

    # image handling
    append rss "<image>\n"
    array set iarray $image

    append rss "<title>[ns_quotehtml $iarray(title)]</title>\n"
    append rss "<url>$iarray(url)</url>\n"
    append rss "<link>[ns_quotehtml $iarray(link)]</link>\n"
    if {[info exists iarray(width)]} {
        set element [ns_quotehtml $iarray(width)]
        append rss "<width>$element</width>\n"
    }
    if {[info exists iarray(height)]} {
        set element [ns_quotehtml $iarray(height)]
        append rss "<height>$element</height>\n"
    }
    if {[info exists iarray(description)]} {
        set element [ns_quotehtml $iarray(description)]
        append rss "<description>$element</description>\n"
    }

    append rss "</image>\n"

    # now do the items
    foreach item $items {
        array unset iarray
        array set iarray $item
        append rss "<item>\n"
        set element [ns_quotehtml $iarray(title)]
        append rss "<title>$element</title>\n"
        append rss "<link>[ns_quotehtml $iarray(link)]</link>\n"
        if {[info exists iarray(description)]} {
            set element [ns_quotehtml $iarray(description)]
            if {[info exists iarray(timestamp)]} {
                # if {[info exists iarray(timeformat)]} {
                    # set timeformat $iarray(timeformat)
                # } else {
                    set timeformat "%B %e, %Y %H:%M%p %Z"
                # }
                set timestamp [clock format [clock scan $iarray(timestamp)]  -format $timeformat]
                append element $timestamp"
            }
            append rss "<description>$element</description>\n"
        }
        append rss "</item>\n"
    }

    append rss "</channel>\n"
    append rss "</rss>\n"

    return $rss
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: