Display Events in Fullcalendar underneath calendar? - coldfusion

I am having a hard time to do this. The calendar Displays the events in the calendar however, I would like to be able to list the events as well below the calendar so you can see the full name of the events that are in the current month. I have the following code(I am using coldfusion and Mura and I am new to both):
<cffunction name="MultipleFeaturedEvents">
<cfargument name="feedName" type="string" default="702771E7-155D-0201-11DF8865B175735F"/>
<cfargument name="maxMonths" type="numeric" default="3" />
<cfargument name="groupDailyEvents" default="true" />
<cfscript>
var rs = '';
var subRS1 = '';
var local = {};
local.listIDs = '';
local.util = $.getCalendarUtility();
local.rsItems = local.util.getCalendarItems(calendarid=arguments.feedName, start=Now(), end=DateAdd('m', val(4), Now()));
var qoq = new Query();
qoq.setDBType('query');
qoq.setAttributes(rs=local.rsItems, maxRows=val(1));
qoq.setSQL('
SELECT *
FROM rs
ORDER BY displaystart ASC
');
var qoqResult = qoq.execute().getResult();
local.it = $.getBean('contentIterator').setQuery(qoqResult);
</cfscript>
<cfsavecontent variable="local.str">
<cfoutput>
<cfset ctr=1 />
<!---<div>#local.it.hasNext()#</div>--->
<cfloop condition="(local.it.hasNext()) AND (ctr LT 4)">
<cfset local.item = local.it.next() >
<cfif not ListFind(local.listIDs, local.item.getValue('contentid'))>
<cfif ctr eq 1>
<!--- TODO: set a default image if no image is available --->
<div class="hidden-xs col-md-2">
<p class="upcoming-events-image"><img src="#local.item.getImageURL()#" alt="#HTMLEditFormat(local.item.getTitle())#"> </p>
</div>
<div class="col-md-offset-0 col-md-4" id="featured-event">
<h3>#HTMLEditFormat(local.item.getMenuTitle())#</h3>
<i class="fa fa-calendar fixIconCal"></i>
<!---#local.item.getDisplaystart()#--->
#LSDateFormat(local.item.getValue('displayStart'), "mmm d, yyyy")#
<cfquery dbtype="query" name="subRS1">
select *
from rsItems
where rsItems.contentid = <cfqueryparam value="#local.item.getValue('contentid')#" />
</cfquery>
<cfif subRS1.recordcount gt 1>
<!--- end date --->
<cfset enddate = ListLast(ValueList(subRS1.displaystop)) />
<cfif IsValid('date', enddate)>
- #LSDateFormat(enddate)#
</cfif>
</cfif>
<br />
<i class="fa fa-clock-o"></i>
#timeFormat(local.item.getValue('displayStart'), "h:mm tt")# - #timeFormat(local.item.getValue('displayStop'), "h:mm tt")#
<br />
<i class="fa fa-map-marker"></i>
Location Information
<!--- Summary --->
<div class="featured-event-summary">
<cfif Len(local.item.getValue('summary'))>
#local.item.getValue('summary')#
</cfif>
</div>
</div>
<cfelse>
</cfif>
</cfif>
</cfloop>
</cfoutput>
</cfsavecontent>
<cfreturn local.str />
</cffunction>
Below is what I am trying to do:
Any help would be appreciated. Thanks

Don't know if you can use plain JS (I don't know ColdFusion), but typically you can retrieve all FullCalendar events by invoking:
$('#calendar').fullCalendar('clientEvents')
Which returns array of Events, then you can iterate over it and render some list.
Hope this helps.
EDIT:
So maybe something like
$('#calendar').fullCalendar('clientEvents', function(ev) {
//will loop for each event you have in the calendar
console.log(ev); //event
});
And you can use something like:
$('#calendar').fullCalendar('clientEvents', function(ev) {
$('.your-list-container').append('<div>' + ev.title + '</div>');
});

this is js code , hope its help you ..
//get the start and the end of the current view
var startDate = $('#idOfCalendar').fullCalendar('getView').start;
var endDate = $('#idOfCalendar').fullCalendar('getView').end;
var eventsNames= new Array();
var todaysEvents = $('#idOfCalendar').fullCalendar('clientEvents', function (event) {
if (event.start >= startDate && event.start <= endDate
|| event.end >= startDate && event.end <= endDate) {
eventsNames.push(event.title)
//take what do you whant from the event object
return true;
}
});

Related

Issue while populating JSON data to Jquery datatable in ColdFusion

I'm using coldFusion 2016 and I'm facing one issue when I'm putting json data to my Jquery datatable. The datatable is only showing processing message.
The JSON result seems to be error free but i don't know what is the issue.
Here is my datatable implementation
<head>
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js"></script>
<link href="https://cdn.datatables.net/1.10.16/css/jquery.dataTables.min.css" rel="stylesheet">
<script type="text/javascript">
var table = '';
$(document).ready(function() {
table = $('#example').DataTable( {
"bProcessing": true,
"bServerSide": true,
"ajax": "uploadProcess.cfc?method=getDetails&partyId=100004",
"sPaginationType": "full_numbers",
"oLanguage": {
"sProcessing": "Wait please...",
"sZeroRecords": "No records found.",
"sInfo": "Users from _START_ to _END_ of _TOTAL_ total",
"sInfoEmpty": "Users from 0 to 0 of 0 total"
},
"aoColumns": [
{ "data": "ID" },
{ "data": "ORG_NAME" },
{ "data": "TYPE" },
{ "data": "PATH" },
{ "data": "URL" },
{ "data": "DELETE" }
]
});
});
</script>
</head>
<body>
<div id="dataDiv">
<table id="example" class="display" cellspacing="0" width="100%">
<thead>
<tr>
<th>Id</th>
<th>File Name</th>
<th>Type</th>
<th>Path</th>
<th>Preview</th>
<th>Delete</th>
</tr>
</thead>
</table>
</div>
</body>
Here is my uploadProcess.cfc
<cfcomponent>
<cffunction name="getDetails" access="remote" returnFormat="json">
<cfargument name="partyId" type="string" required="yes">
<cfparam name="arguments.iDisplayStart" default="0">
<cfparam name="arguments.iDisplayLength" default="10">
<cfparam name="arguments.iSortCol_0" default="UploadFileID">
<cfparam name="arguments.sSortDir_0" default="ASC">
<cfparam name="arguments.sEcho" default="1">
<cfstoredproc procedure="get_upload_file_details" datasource="standout">
<cfprocparam value="#partyId#" cfsqltype="CF_SQL_INT">
<cfprocparam value="#arguments.iDisplayStart#" cfsqltype="CF_SQL_INT">
<cfprocparam value="#arguments.iDisplayLength#" cfsqltype="CF_SQL_INT">
<cfprocparam value="#arguments.iSortCol_0#" cfsqltype="CF_SQL_VARCHAR">
<cfprocparam value="#arguments.sSortDir_0#" cfsqltype="CF_SQL_VARCHAR">
<cfprocresult name="getUploadDtls">
</cfstoredproc>
<cfset userArray = arrayNew(1)>
<cfloop query="getUploadDtls">
<cfif UserSessionID eq "">
<cfset deleteLink = "<span class='delete-link link'>Delete</span>" />
<cfelse>
<cfset deleteLink = "">
</cfif>
<cfset userStruct = {}>
<cfset userStruct.ID = UploadFileID>
<cfset userStruct.ORG_NAME = OriginalFileName>
<cfset userStruct.GEN_NAME = SystemFileName>
<cfset userStruct.TYPE = DocumentName>
<cfset userStruct.PATH = FilePath>
<cfset userStruct.URL = "<a href='renderpdf.cfm?path=#FilePath#&name=#OriginalFileName#' target='_blank'>Preview</a>">
<cfset userStruct.DELETE = deleteLink>
<cfset arrayAppend(userArray, userStruct) >
</cfloop>
<cfif getUploadDtls.RecordCount GT 0>
<cfset firstRow = queryGetRow(getUploadDtls,1)>
<cfset record_count = firstRow.record_count>
<cfelse>
<cfset record_count = 0>
</cfif>
<cfset returnStruct = {}>
<cfset returnStruct['iTotalRecords'] = record_count>
<cfset returnStruct['iTotalDisplayRecords'] = record_count>
<cfset returnStruct['sEcho'] = arguments.sEcho>
<cfset returnStruct['aaData'] = userArray>
<cfset resultsJSON = SerializeJSON(returnStruct)>
<cfreturn resultsJSON>
</cffunction>
</cfcomponent>
The Json result returning from my cffunction is given below.
{""aaData"":[{""GEN_NAME"":""sample_489.pdf"",""PATH"":""C://Standout/web_uploads/100004/Medical Reports/sample_489.pdf"",""DELETE"":"""",""ORG_NAME"":""sample.pdf"",""ID"":77,""TYPE"":""Medical Report"",""URL"":""<a href='renderpdf.cfm?path=C://Standout/web_uploads/100004/Medical Reports/sample_489.pdf&name=sample.pdf' target='_blank'>Preview</a>""}],""iTotalDisplayRecords"":1,""iTotalRecords"":1,""sEcho"":1}"
I can't figure out what is the issue can someone help?
First of I would remove those curly braces you use wrapping your structs.
SerializeJson() already works pretty well if you just pass in your structs.
It seems like your JSON is not valid which is probably causing the error, or your datatable isn't configured properly.
Honestly I'd recommend just filling your table with a cfloop.
<cfloop query="myQuery">
<tr>
<td>
#myQuery.someData#
</td>
...
</tr>
</cfloop>
If you load your data on page load this solution might work just as well.
The datatable API can be hit or miss sometimes imo.

Date issue in coldfusion

I have a report which has the date selection as show below. When the report is first loaded it will show the data for the current month ie in this case from {ts '2014-06-01 00:00:00'} to {ts '2014-07-01 00:00:00'};range in all the queries on the page. When I select a date from the dropdown and submit the page, the queries still take the start and end date as 6/1 to 7/1 instead of the selected month. I tried debugging it but still not able to get it to work. Any suggestions here?
I have updated My form is like below. I want the first radio button to be selected on the first page load, I am just making the other selection empty on click of the radio button. Is there a way to save what is in the selection and just display results for the criteria selected?please suggest
<script>
function makeChoice() {
var obj1 = document.getElementById('month_dt')
var obj2 = document.getElementById('start_date')
var obj3 = document.getElementById('end_date')
if (document.getElementById('but1').checked) {
obj2.value = '';
obj3.value = '';
}
else if (document.getElementById('but2').checked) {
obj1.value = '';
}
}
</script>
<form name="month_year" method="get">
<div>
<table>
<tr>
<th align="right">
<input type="radio" name="datesel" value="1" id="but1" onClick="return makeChoice();"/>
Month/Year:</th>
<td align="left">
<select name="month_dt" id="month_dt">
<option value="">---Select one---</option>
<cfloop from="0" to="#diff_month_cnt#" index="ii">
<cfset temp_dt = dateAdd("m", -1 * ii, today) />
<cfset temp_dt = createDate(year(temp_dt), month(temp_dt), 1) />
<cfset isselected = "" />
<cfif temp_dt EQ the_month_dt>
<cfset isselected = "selected" />
</cfif>
<option value="#dateFormat(temp_dt, 'mm/dd/yyyy')#" #isselected#>#dateFormat(temp_dt, "mmmm yyyy")#</option>
</cfloop>
</select>
</td>
</tr>
<tr><td colspan="2" align="center"><em>- or -</em></td></tr>
<tr>
<th align="right"> <input type="radio" name="datesel" value="2" id="but2" onClick="return makeChoice();"/>Start Date:</th>
<td>
<input id="start_date" type="text" name="start_date" <cfif isdate(url.start_Date)>value="#dateFormat(url.start_date, 'mm/dd/yyyy')#"</cfif> size="10" maxlength="10" autocomplete="off" />
</td>
</tr>
<tr>
<th align="right">End Date:</th>
<td>
<input id="end_date" type="text" name="end_date" <cfif isdate(url.end_Date)>value="#dateFormat(url.end_date, 'mm/dd/yyyy')#"</cfif> size="10" maxlength="10" autocomplete="off" />
</td>
</tr>
<input type="submit" value=" OK " />
<cfif isDate(url.month_dt) and url.datesel eq 1>
<cfset begin_dt = createDate(year(month_dt), month(month_dt), 1) />
<cfset end_dt = dateAdd("m", 1, begin_dt) />
<cfelseif isDate(url.start_date) AND isDate(url.end_date) and url.datesel eq 2 >
<cfset begin_dt = url.start_date />
<cfset end_dt = url.end_date />
</cfif>
<cfset the_month_dt = createDate(year(begin_dt), month(begin_dt), 1) />
In the queries like
1) WHERE q.quizdate >= <cfqueryparam cfsqltype="CF_SQL_DATE" value="#the_month_dt#" />
AND q.quizdate < <cfqueryparam cfsqltype="CF_SQL_DATE" value="#dateAdd('m', 1, the_month_dt)#" />
2) WHERE r.create_dt >= <cfqueryparam cfsqltype="CF_SQL_DATE" value="#begin_dt#" />
AND r.create_dt < <cfqueryparam cfsqltype="CF_SQL_DATE" value="#end_dt#" />
You need to change the following code:
<cfif isDate(url.month_dt)>
<cfset begin_dt = createDate(year(month_dt), month(month_dt), 1) />
</cfif>
<cfif isDate(url.start_date)>
<cfset begin_dt = url.start_date />
</cfif>
<cfset end_dt = dateAdd("m", 1, begin_dt) />
<cfif isDate(url.end_date)>
<cfset end_dt = url.end_date />
</cfif>
to be:
<cfif isDate(url.month_dt)>
<cfset begin_dt = createDate(year(month_dt), month(month_dt), 1) />
<cfset end_dt = dateAdd("m", 1, begin_dt) />
<cfelseif isDate(url.start_date) AND isDate(url.end_date)>
<cfset begin_dt = url.start_date />
<cfset end_dt = url.end_date />
</cfif>
Use DaysInMonth to look for the last date in month. As more info is given in the question, my answer is modified a bit. You need to disable and clear the values in Start/End form fields when a user chooses to select by month and vice versa. Otherwise, the users might get confused. Place the code before the form to get the start/end dates selected by a user. The final start/end dates are begin_dt and end_dt
<cfset thisMonth = createDate(year(now()), month(now()), 1) />
<cfparam name="url.month_dt" default="" />
<cfparam name="url.start_date" default="" />
<cfparam name="url.end_date" default="" />
<cfparam name="bRadioMonth" default="" />
<cfparam name="bRadioStartEnd" default="" />
<cfif len(url.month_dt) AND isDate(url.month_dt)>
<cfset begin_dt = createDate(year(url.month_dt), month(url.month_dt), 1) />
<cfset end_dt = createDate(year(begin_dt), month(begin_dt), DaysInMonth(begin_dt)) />
<!--- Disable form fields start_date and end_date --->
<cfset bFieldMonth = "">
<cfset bFieldStartEnd = "disabled">
<cfset bRadioMonth = "checked">
<cfelseif len(url.start_date) AND len(url.end_date)
AND isDate(url.start_date) AND isDate(url.end_date)>
<cfset begin_dt = createDate(year(url.start_date), month(url.start_date), day(url.start_date)) />
<cfset end_dt = createDate(year(url.end_date), month(url.end_date), day(url.end_date)) />
<!--- Disable form field month_dt --->
<cfset bFieldMonth = "disabled">
<cfset bFieldStartEnd = "">
<cfset bRadioStartEnd = "checked">
<cfelse>
<cfset begin_dt = thisMonth />
<cfset end_dt = createDate(year(begin_dt), month(begin_dt), DaysInMonth(begin_dt)) />
<!--- Default to disable form fields start_date and end_date --->
<cfset bFieldMonth = "">
<cfset bFieldStartEnd = "disabled">
<cfset bRadioMonth = "checked">
</cfif>
javascript:
<script>
function makeChoice() {
var fieldMonth = document.getElementById('month_dt');
var fieldStart = document.getElementById('start_date');
var fieldEnd = document.getElementById('end_date');
if (document.getElementById('but1').checked) {
fieldMonth.disabled = false;
fieldStart.disabled = true;
fieldEnd.disabled = true;
fieldStart.value = '';
fieldEnd.value = '';
}
else if (document.getElementById('but2').checked) {
fieldMonth.options[0].selected = true;
fieldMonth.disabled = true;
fieldStart.disabled = false;
fieldEnd.disabled = false;
}
}
</script>
If form is submitted, return selected start/end dates and run query:
<cfoutput>
Selected Start Date: #dateFormat(begin_dt, 'mm/dd/yyyy')# End Date: #dateFormat(end_dt, 'mm/dd/yyyy')#
</cfoutput>
<cfif isdefined("form.submit")>
<!---
Run Query.
1) WHERE q.quizdate >= <cfqueryparam cfsqltype="CF_SQL_DATE" value="#begin_dt#" />
AND q.quizdate < <cfqueryparam cfsqltype="CF_SQL_DATE" value="#DATEADD('d',1,end_dt)#" />
2) WHERE r.create_dt >= <cfqueryparam cfsqltype="CF_SQL_DATE" value="#begin_dt#" />
AND r.create_dt < <cfqueryparam cfsqltype="CF_SQL_DATE" value="#DATEADD('d',1,end_dt)#" />
--->
</cfif>

Accessing Query Data from CFC Function

Here is what I am up against: I am trying to change the content of a CFDIV based on the selection from a CFSelect box.
To do this I have bound the CFDiv to a CFC and I am trying to return two columns from my query that is executed in that CFC; Alert_Status AND Alert_Priority. These values will be queried based on a selection from the CFSelect box in my CFM page. Company_Name is the value passed to the CFC from the selection in the CFSelect box. Once the query in the CFC is run, I would like to display the results in a DIV on that same CFM page as the select box.
Here is the CFC:
<!---First Slect Box --->
<cffunction name="getData" access="remote" returntype="query">
<cfoutput>
<!--- Function to get data from datasource --->
<cfquery name="data" datasource="#datasource#">
select company_name, customer_id
from customer_table
where status <> '0'
order by company_name
</cfquery>
</cfoutput>
<!--- Return results --->
<cfreturn data>
</cffunction>
<cffunction name="getDetail" access="remote" returnType="string">
<cfargument name="company_name" type="any" required="true">
<!--- localize function variables --->
<cfset var dataDetail = "">
<cfoutput>
<cfquery name="dataDetail" datasource="#datasource#">
SELECT tax_rate
FROM customer_table
<!--- adjust cfsqltype if needed --->
WHERE company_name = <cfqueryparam value="#ARGUMENTS.company_name#" cfsqltype="cf_sql_varchar">
</cfquery>
</cfoutput>
<cfreturn dataDetail.tax_rate>
</cffunction>
<cffunction name="getAlerts" access="remote" returnType="query">
<cfargument name="company_name" type="any" required="true">
<!--- localize function variables --->
<cfset var alertDetail = "">
<cfoutput>
<cfquery name="getID" datasource="#datasource#">
select customer_id
from customer_table
where company_name = <cfqueryparam value="#ARGUMENTS.company_name#" cfsqltype="cf_sql_varchar">
</cfquery>
<cfquery name="alertDetail" datasource="#datasource#">
SELECT *
FROM customer_alerts
<!--- adjust cfsqltype if needed --->
WHERE customer_id = <cfqueryparam value="#getID.customer_id#" cfsqltype="cf_sql_varchar"> AND alert_status = 'on'
</cfquery>
</cfoutput>
<cfreturn alertDetail>
</cffunction>
I am trying to display the query results for the query AlertDetail in a div on my main page.
Here is the portion of my CFM page that relates to this CFC:
<cfdiv name="test" id="test" type="text" bind="cfc:cfcs.taxdata.getAlerts({company_name})" bindonload="true" bindattribute="value" rows="2" cols="2" readonly="yes"></cfdiv>
Any help would be greatly appreciated. Thanks.
-Brian
Let's step back for a moment. I see your goal and sometimes using CFDiv only complicates things. I would just use AJAX. I wasn't sure what you meant by "two columns" so the current example I am sending you only shows one function being returned. Adding the second will be pretty easy to replicate.
<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script>
// populate the dropdown
$.ajax({
type: "GET",
url:"cfcs/taxdata.cfc?method=getData",
dataType: "json",
success: function (data) {
$("#formSelect").html("");
// may need tweeking depending on how you are outputting your query.
$.each(data,function(i,obj)
{
var div_data="<option value="+obj+">"+obj+"</option>";
$(div_data).appendTo('#formSelect');
});
}
});
// on change of dropdown value return the cfc data into the div
$("#formSelect").change(function() {
var selectValue = $("#formSelect").val();
$.ajax({
type: "GET",
url:"cfcs/taxdata.cfc?method=getAlerts",
dataType: "json",
data: {
company_name: selectValue
},
success: function (data) {
$("#test").html(data);
}
});
});
</script>
</head>
<body>
<form>
<select id="formSelect">
</select>
</form>
<div id="test"></div>
</body>
Also, below is how you can add multiple results to the <div>
<!-- Use multiple AJAX calls to each function. Have them return in separate divs within the main div. -->
<div id="test">
<div id="query1"></div>
<div id="query2"></div>
<div id="query3"></div>
<!-- You can also do paragraph tags. JQuery only looks for the ID or class -->
<p id="query4"></p>
</div>
Option Two
<!--
In your ajax instead of using $("#test").html(data); you can use appentTo() for each AJAX call
-->
success: function (data) {
$(data).appendTo('#test');
}

scraping data hurdles with coldfusion

I am working on a scraping and i need to extract the informaion of the websites, basically it is giving link to inside pages
Here is my Small try with scraping, i am able to get the names of the states but i need to go deeper now as i admit, i am very bad at regular expressions
Please guide. here is my code
<cfscript>
function stripHTML(str) {
str = reReplaceNoCase(str, "<*style.*?>(.*?)</style>","","all");
str = reReplaceNoCase(str, "<*script.*?>(.*?)</script>","","all");
str = reReplaceNoCase(str, "<.*?>","","all");
str = reReplaceNoCase(str, "^.*?>","");
str = reReplaceNoCase(str, "<.*$","");
return trim(str);
}
</cfscript>
<cfset start = false>
<cfhttp url="http://www.mapsofindia.com/pincode/" method="get"></cfhttp>
<cfset status = cfhttp.Statuscode>
<cfif status IS '200 OK'>
<cfset start = true>
</cfif>
<cfif start>
<cfset string = cfhttp.filecontent />
<cfset StartText = '<table cellpadding=4 cellspacing=0 align="center" border="0" class=extrtable width="90%">' />
<cfset Start = FindNoCase(StartText, string, 1) />
<cfset EndText='<td style="width:50%"> </td></tr></table><br /><br />' />
<cfset Length=Len(StartText) />
<cfset End = FindNoCase(EndText, string, Start) />
<cfset parse = Mid(string, Start+Length, End-Start-Length) />
<cfset parse = Insert('+',parse,FindNoCase("</a>", parse))>
<cfset parse = trim(parse) />
<cfset dbData = stripHTML(ListQualify(parse,'+'))>
<cfloop list="#createLst#" index="k" delimiters="+">
<cfquery name="insert_data" datasource="#request.dsn#">
INSERT INTO cw_states(state,countrycode,country)
VALUES('#k#','IN','India')
</cfquery>
</cfloop>
<table align="center">
<cfoutput>#parse#<br></cfoutput>
</tr>
</table>
</cfif>
This is listing the cfoutput on page correctly, but i am unable to insert into the database.
Question #2: The link is taking to another page which lists the cities of the state, i want to append my page like index2.cfm?url=#link# which will extract the cities and insert the cities in my cities table and again on the link it should be like index3.cfm?url=#link# which will open another page of zip and insert those zip names in the database
Please guide

Coldfusion REReplace (to parse Twitter Feed)

I have a twitter feed in the format:
1. Username: Blah blah http://something.com #hashtag
2. Username: Blah blah http://something.com #hashtag
3. Username: Blah blah http://something.com #hashtag
I'm removed the username, but how do I wrap tags (for styling) around the http:// parts and the #hashtags?
Here is my current coldfusion code:
<cfset feedurl="http://twitter.com/statuses/user_timeline/MyUserID.rss" />
<cffeed
source="#feedurl#"
properties="feedmeta"
query="feeditems" />
<cffeed
source="#feedurl#"
properties="feedmeta"
query="feeditems" />
<ul>
<cfoutput query="feeditems">
<cfsavecontent variable="twitterString">
#content#
</cfsavecontent>
<li>#REReplace(twitterString, "UserName: ", "")#</li>
</cfoutput>
</ul>
This worked for me:
<cfset feedurl="http://twitter.com/statuses/user_timeline/jakefeasel.rss" />
<cffeed
source="#feedurl#"
properties="feedmeta"
query="feeditems" />
<cffeed
source="#feedurl#"
properties="feedmeta"
query="feeditems" />
<ul>
<cfoutput query="feeditems">
<cfsavecontent variable="twitterString">
#REReplace(content, "UserName: ", "")#
</cfsavecontent>
<cfset formattedString = twitterString>
<cfloop array='#[{"regex" = 'http://\S+', "class" = "URL"}, {"regex" = "##\w+", "class" = "hashTag"}]#' index="regexStruct">
<cfset currentPos = 0>
<cfset matches = ReFindNoCase(regexStruct.regex, twitterString, currentPos, true)>
<cfloop condition="matches.len[1] IS NOT 0">
<cfset formattedString = Replace(formattedString, mid(twitterString, matches.pos[1], matches.len[1]), "<span class='#regexStruct.class#'>" & mid(twitterString, matches.pos[1], matches.len[1]) & "</span>")>
<cfset currentPos = matches.pos[1] + matches.len[1]>
<cfset matches = ReFindNoCase(regexStruct.regex, twitterString, currentPos, true)>
</cfloop>
</cfloop>
<li>
#formattedString#
</li>
</cfoutput>
</ul>
You'll obviously have to provide styles for the "URL" and "hashtag" classes.