![]() |
|
||||
|
I'm assuming that her titles and news bodies are stored somewhere in the database?
Code:
<?
$sql = "SELECT * FROM news limit 5";
$result = mysql_query($sql);
while($row = mysql_fetch_assoc($result)){
?>
<item>
<title><?=$row['title']; ?></title>
<author><?=$row['author']; ?></author>
<link>http://MYSITE.com/news.php?id=<?=$row['id']; ?></link>
</item>
<?
}
?>
Charles |
|
||||
|
Thanks for the response CharlesH...
Here's the webpage where her articles are located: Anton Communications Publisher Profile - iContact Community I want the list like what is shown in the 2nd box down on the right: "Publications" The site offers the rss feed, but you see the whole messages - I'd like to have just the titles... Thanks again! |
|
||||
|
Lynne, if I understand correctly, your client is Anton Communications and they have an account with iContact Community, but you have no access to the source for the iContact server software. If this is so, then your best hope would be a configuration option to alter the RSS format. That is, in your account interface, maybe they let you customize the RSS output (I highly doubt this, but it would be cool).
However, even if the above is true, I can think of a potential workaround -- a way to re-feed the feed, so to speak. It's only of use if you have control over the link(s) to the feed, or if your client is the only one making use of the feed (in which case the solution is easier still). Do I have your situation right? How is the feed to be used (by your client or the public?)
__________________
Brian Dominick | WebRoot Solutions | Server Administrator, Software Developer http://mywebroot.com Last edited by bdominick; 06-11-2008 at 01:13 AM. |
|
||||
|
Hi Brian! Thanks for your response.
Yes, I do not have access to there server software and no, they don't offer to customize the feed. Quote:
Anton Communications - Public Relations by Genevieve Anton, Southern California It has the client news release title, headline, and date of release. I like it the way icontact has it displayed here: antonpr's Member Profile - iContact Community I found a rss to js thing last night - the results are here: test I'm concerned about visitors who don't have javascript enabled though. I don't know how we would get the headline unless I coded some sort of id into the news release headline - if that's even possible.... I have an aggregator script someone made and let me use on another site, but it's been a couple of years and I was pretty lost on the whole concept at the time. Just an fyi: I am doing her site maintenance (as her designer is super busy) so I have access to the ftp but not neccessarily her control panel. Thanks so much for your help! Last edited by rlhanson; 06-11-2008 at 09:24 AM. Reason: added a link :) |
|
||||
|
Hi Lynn. So if you're just trying to use the feed on your client's own site, the javascript option looks pretty good. I've used it before. Yeah, some users don't have javascript enabled, but in those cases they just don't see the feed -- it's not like it screws everything up.
There is another option. You could use a server-side application to generate a custom display of the feed (titles only) and then use an iframe to include that display in the page. This option doesn't require js, though it does require a modern browser. For this method you would have to install something on the site, though -- probably I'd recommend a simple PHP script that imports and displays RSS. One that caches the RSS would be optimal, since it wouldn't require calls to the iContact server during parsing or page loading (like the js solution does). But in terms of page loading, the PHP solution should be a good bit faster than the js solution.
__________________
Brian Dominick | WebRoot Solutions | Server Administrator, Software Developer http://mywebroot.com |
|
||||
|
Or, if you went with the server-side option, you could also just change the name of client_news.htm to client_news.php and call the RSS script right from the page, skipping the iframe and making the whole thing browser neutral.
__________________
Brian Dominick | WebRoot Solutions | Server Administrator, Software Developer http://mywebroot.com |
|
||||
|
Great. It should be pretty easy to tell what to alter to get just the headline/link to show up, but if it's not, feel free to paste the script here and I can show you what to alter. Sounds like you've got it figured out.
__________________
Brian Dominick | WebRoot Solutions | Server Administrator, Software Developer http://mywebroot.com |
|
||||
|
Hey Brian -
Well, turns out my client is on an asp server so I have downloaded a rss2html asp script. I don't know if it's the script or the feed but I can't get the date to show up using either the asp or the javascript solution. So here's the page I would like it to look like: Anton Communications - Public Relations by Genevieve Anton, Southern California Here's the asp page: Anton Communications - Public Relations by Genevieve Anton, Southern California And the js page: Anton Communications - Public Relations by Genevieve Anton, Southern California rss2html.asp Code:
<% Response.Expires = -1 ' =========== RSS2HTML.ASP for ASP/ASP.NET ========== ' copyright 2005-2008 (c) www.Bytescout.com ' version 1.26, 28 May 2008 ' =========== configuration ===================== ' ##### URL to RSS Feed to display ######### URLToRSS = "Anton Communications" ' ##### max number of displayed items ##### MaxNumberOfItems = 7 ' ##### Main template constants MainTemplateHeader = "<table>" MainTemplateFooter = "</table>" ' ##### ' ###################################### Keyword1 = "" ' Keyword1 = "tech" - set non-empty keyword value to filter by this keyword Keyword2 = "" ' Keyword1 = "win" - set non-empty keyword value to filter by this 2nd keyword too ' ################################# ' ##### Item template. ' ##### {LINK} will be replaced with item link ' ##### {TITLE} will be replaced with item title ' ##### {DESCRIPTION} will be replaced with item description ' ##### {DATE} will be replaced with item date and time ' ##### {COMMENTSLINK} will be replaced with link to comments (if you use RSS feed from blog) ' ##### {CATEGORY} will be replaced with item category ItemTemplate = "<tr><td><font face=Tahoma, Humanst521 BT, Verdana, Arial><font size=2><strong>{DATE}</strong><br/><strong>{CATEGORY}<br/></strong><a href=" & """{LINK}""" & ">{TITLE}</a><BR></font></td></tr>" ' ##### Error message that will be displayed if not items etc ErrorMessage = "Error has occured while trying to process " &URLToRSS & "<BR>Please contact web-master" ' ================================================ Set xmlHttp = Server.CreateObject("MSXML2.ServerXMLHTTP.3.0") xmlHttp.Open "GET", URLToRSS, false xmlHttp.Send() RSSXML = xmlHttp.ResponseText Set xmlDOM = Server.CreateObject("MSXML2.DomDocument.3.0") xmlDOM.async = False xmlDOM.validateOnParse = False xmlDom.resolveExternals = False If not xmlDOM.LoadXml(RSSXML) Then ErrorMessage = "Can not load XML:" & vbCRLF & xmlDOM.parseError.reason & vbCRLF & ErrorMessage End If Set xmlHttp = Nothing ' clear HTTP object Set RSSItems = xmlDOM.getElementsByTagName("item") ' collect all "items" from downloaded RSS RSSItemsCount = RSSItems.Length-1 ' if not <item>..</item> entries, then try to get <entry>..</entry> if RSSItemsCount = -1 Then Set RSSItems = xmlDOM.getElementsByTagName("entry") ' collect all "entry" (atom format) from downloaded RSS RSSItemsCount = RSSItems.Length-1 End If Set xmlDOM = Nothing ' clear XML ' writing Header if RSSItemsCount > 0 then Response.Write MainTemplateHeader End If j = -1 For i = 0 To RSSItemsCount Set RSSItem = RSSItems.Item(i) ' fix for the issue when a description from a previous item ' is used if current item description is empty provided by George Sexton RSSdescription=" " RSSCommentsLink=" " for each child in RSSItem.childNodes Select case lcase(child.nodeName) case "title" RSStitle = child.text case "link" If RSSLink = "" Then If child.Attributes.length>0 Then RSSLink = child.GetAttribute("href") if (RSSLink <> "") Then if child.GetAttribute("rel") <> "alternate" Then RSSLink = "" End If End If End If ' if has attributes If RSSLink = "" Then RSSlink = child.text End If End If case "description" RSSdescription = child.text case "content" ' atom format RSSdescription = child.text case "published"' atom format RSSDate = child.text case "pubdate" RSSDate = child.text case "comments" RSSCommentsLink = child.text case "category" Set CategoryItems = RSSItem.getElementsByTagName("category") RSSCategory = "" for each categoryitem in CategoryItems if RSSCategory <> "" Then RSSCategory = RSSCategory & ", " End If RSSCategory = RSSCategory & categoryitem.text Next End Select next ' now check filter If (InStr(RSSTitle,Keyword1)>0) or (InStr(RSSTitle,Keyword2)>0) or (InStr(RSSDescription,Keyword1)>0) or (InStr(RSSDescription,Keyword2)>0) then j = J+1 if J<MaxNumberOfItems then ItemContent = Replace(ItemTemplate,"{LINK}",RSSlink) ItemContent = Replace(ItemContent,"{TITLE}",RSSTitle) ItemContent = Replace(ItemContent,"{DATE}",RSSDate) ItemContent = Replace(ItemContent,"{COMMENTSLINK}",RSSCommentsLink) ItemContent = Replace(ItemContent,"{CATEGORY}",RSSCategory) Response.Write Replace(ItemContent,"{DESCRIPTION}",RSSDescription) ItemContent = "" RSSLink = "" End if End If Next ' writing Footer if RSSItemsCount > 0 then Response.Write MainTemplateFooter else Response.Write ErrorMessage End If ' Response.End ' uncomment this for use in on-the-fly output %> HTML Code:
<table width="90%" border="1" align="center" cellpadding="10" cellspacing="0" bordercolor="#254D67"> <tr bgcolor="#254D67"> <td width="35%" align="center" valign="top"><strong><font size="2" color="#ffffff" face="Tahoma, Humanst521 BT, Verdana, Arial">Client</font></strong></td> <td width="55%" align="center" valign="top"><strong><font size="2" color="#ffffff" face="Tahoma, Humanst521 BT, Verdana, Arial">Headline</font></strong></td> <td width="10%" align="center" valign="top"><strong><font size="2" color="#ffffff" face="Tahoma, Humanst521 BT, Verdana, Arial">Date</font></strong></td> </tr> <tr class="style1"> <td width="35%" align="left" valign="top"><span class="style1"><font face="Tahoma, Humanst521 BT, Verdana, Arial">Cynthia Britain Studios</font></span></td> <td width="55%" align="left" valign="top"><div align="justify" class="style1"><font face="Tahoma, Humanst521 BT, Verdana, Arial"><!--#include virtual="RSS2HTML.asp"--></font></div></td> <td width="10%" align="center" valign="top"> </td> </tr> </table> Anton Communications Publisher Profile - iContact Community If it's a major undertaking to help me figure this out - let me know - I will go with the js solution for now. Thanks in advance! |