Skip to main content
June 2, 2014
Answered

how to combine strings to get more info into an rss feed

  • June 2, 2014
  • 1 reply
  • 218 views

When creating an rss feed, we only have 4 fields to use, date, title, content and link. How can i combine two fields creating one field out of two?

    This topic has been closed for replies.
    Correct answer BKBK

    You could just modify the query accordingly. Do something like

    <!--- I am on MySQL, hence concat()--->

    <cfquery name="TestQuery" datasource="#application.dsn#">

    SELECT dev_ID, display_date, title, body, scripture, concat(title,'<br />',scripture) as extendedTitle

    FROM devotional

    where display_date = <cfqueryparam value ="#dateformat(now(), "YYYY-MM-DD")#" cfsqltype="cf_sql_date">

    </cfquery>

    1 reply

    BKBK
    Community Expert
    Community Expert
    June 3, 2014

    Could you show us the code you have so far? That would help the discussion.

    June 4, 2014

    I have highlighted the line I am trying to get to work. I am trying to get the title to

    <cfquery name="TestQuery" datasource="#application.dsn#">

    SELECT dev_ID, display_date, title, body, scripture

    FROM devotional

    where display_date = <cfqueryparam value ="#dateformat(now(), "YYYY-MM-DD")#" cfsqltype="cf_sql_date">

    </cfquery>

    <CFSET title = TestQuery.title & "<br />" & TestQuery.scripture>

    <cfscript>

    testStruct = StructNew();

    testStruct.version = "rss_2.0";

    </cfscript>

    <cfscript>

    testStruct = StructNew();

    testStruct.version = "rss_2.0";

    testStruct.title = "Daily Devotionals";

    testStruct.link = "http://mydailydevotionals.com/rss.xml";

    testStruct.description = "Providing Daily Devotionals feed";

    testStruct.pubDate = Now();

    columnMapStruct = StructNew();

    columnMapStruct.publisheddate = "display_date";

    columnMapStruct.title = "title";

    columnMapStruct.content = "body";

    columnMapStruct.rsslink = "dev_ID";

    </cfscript>

    <cffeed action = "create"

    query= "#TestQuery#"

    properties="#testStruct#"

    columnMap="#columnMapStruct#"

    outputFile = "rss.xml"

    overwrite = "yes">

    BKBK
    Community Expert
    BKBKCommunity ExpertCorrect answer
    Community Expert
    June 4, 2014

    You could just modify the query accordingly. Do something like

    <!--- I am on MySQL, hence concat()--->

    <cfquery name="TestQuery" datasource="#application.dsn#">

    SELECT dev_ID, display_date, title, body, scripture, concat(title,'<br />',scripture) as extendedTitle

    FROM devotional

    where display_date = <cfqueryparam value ="#dateformat(now(), "YYYY-MM-DD")#" cfsqltype="cf_sql_date">

    </cfquery>