Question

Showing line spacing in an RSS feed using nl2br

Asked by: nanharbison

I use this line of PHP (see code below) to show a series of announcements submitted on a form by local organizations. Then I also have these announcements on an RSS feed, but if I use the nl2br so that line spacing added by the users, the announcement doesn't show at all. Is there something I am missing here?
You can see the bulletin board here:
http://www.concordtv.org/?q=community-bulletin-board

and the RSS feed is here:
http://www.concordtv.org/site/cbbrss/

<td>'.nl2br($row['announcement']).'</td>

                                  
1:

Select allOpen in new window

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2009-10-14 at 10:23:53ID24812040
Tags

PHP

,

RSS

,

HTML

Topics

RSS

,

PHP and Databases

,

Extensible HTML (XHTML)

Participating Experts
2
Points
500
Comments
22

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. Rss feed creator
    I have some data on a site that I'd like to turn into RSS feeds... Is there a class library or something like that that will let me create RSS feeds? I've seen plenty that will read.. but none that will create

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: gawaiPosted on 2009-10-14 at 11:47:27ID: 25573720

kindly post your php code for rss

 

by: nanharbisonPosted on 2009-10-14 at 12:51:13ID: 25574394

I have posted the code here, it seems to be working better, but I had gone into the database and taken out the weird characters there, like the person entered an asterisk, but in the BD table, it was a weird group of characters (Not the ascii code).
I also use htmlentities() when uploading the form to the DB.

echo	'<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
<?xml-stylesheet type="text/css" href="rss.css" ?>';
 
echo '<channel>
    <title>Community Bulletin Board - CCTV</title>
    <link>http://concordtv.org/site/cbbrss/index.php</link>
    <pubDate>Mon, 04 May 2009 04:00:00 GMT</pubDate>
    <description>Community Bulletin Board (CBB) for ConcordTV (CCTV Inc)</description>';
 
function mysqldate_to_unix_timestamp($date) {
 
    list($year, $month, $day) = explode('-', $date);
    return mktime(0, 0, 0, $month, $day, $year);
}
// connection stuff was here//
 
$db_connection = mysql_connect ($db_info[host], $db_info[username], $db_info[password]) or die (mysql_error());;
mysql_select_db ($db_info[dbname], $db_connection) or die (mysql_error());
$viewannouncementsquery ="SELECT id, heading, announcement, startdate, enddate FROM bulletinboard WHERE approved ='y' ORDER BY id";
$result = mysql_query($viewannouncementsquery) or die('Query failed: ' . mysql_error());
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
	$enddate = 	mysqldate_to_unix_timestamp($row['enddate']);
	$today = date("Y-m-d");
	$todaysdate = 	mysqldate_to_unix_timestamp($today);
	if ($enddate - $todaysdate > 0) {
		$row['heading'] = htmlentities($row['heading'], ENT_QUOTES, "UTF-8");
		$row['announcement'] = htmlentities($row['announcement'], ENT_QUOTES, "UTF-8");
		
		echo '<item>
      			<title>'.$row['heading'].'</title>
				<link>http://www.concordtv.org/site/cbbrss</link>
				<description>'.$row['announcement'].'</description>
				<pubDate>'.$row['startdate'].'</pubDate>
				 <guid>http://www.concordtv.org/site/cbbrss</guid>
		  </item>';
	}
}
echo '</channel>
</rss>';

                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:

Select allOpen in new window

 

by: gawaiPosted on 2009-10-14 at 13:12:11ID: 25574611

u can filter/replace special characters with a function i get it from EE site. even u can use it for form inputs as well

function rssFilter($txt) {
      $dbData[0] = '/\'/';
      $dbData[1] = '/\'/';
      $dbData[2] = '/\/';
      $dbData[3] = '/\/';
      $dbData[4] = '/\/';
      $dbData[5] = '/\/';
      $dbData[6] = '/\`/';
      $dbData[7] = '/\`/';
      $dbData[8] = '/\?/';
      $dbData[9] = '/[\-]/';
      $dbData[10] = '/_/';
      $dbData[11] = '//';
      $dbData[12] = '/ý/';
      $dbData[13] = '/\/';
      $dbData[14] = '/&/';
      $dbData[15] = '/[\]/';
      $dbData[16] = '/[\]/';
      $dbData[17] = '/þ/';
      $rssData[0] = '';
      $rssData[1] = '';
      $rssData[2] = '';
      $rssData[3] = '';
      $rssData[4] = '';
      $rssData[5] = '';
      $rssData[6] = '';
      $rssData[7] = '';
      $rssData[8] = '';
      $rssData[9] = '-';
      $rssData[10] = '-';
      $rssData[11] = '-';
      $rssData[12] = '';
      $rssData[13] = '';
      $rssData[14] = 'and';
      $rssData[15] = '&#45;';
      $rssData[16] = '&#45;';
      $rssData[17] = '';
      $txt = preg_replace($dbData, $rssData, $txt);
      return $txt;
}

$heading = rssFilter($row['heading']);
$announcement = rssFilter($row['announcement']);
                
echo '<item>
<title>$heading</title>
<link>http://www.concordtv.org/site/cbbrss</link>
<description>$announcement</description>
                                              
1:
2:
3:
4:
5:
6:
7:

Select allOpen in new window

 

by: gawaiPosted on 2009-10-14 at 13:17:54ID: 25574671

filter.php

 

by: nanharbisonPosted on 2009-10-14 at 15:15:16ID: 25575762

This is excellent for getting rid of the weird characters, but what about when I want to us
nl2br
so the entries in the database maintain their line spacing?
It still doesn't work on the RSS feed. You can see on the Community Bulletin Board page on the website, there is spacing in the announcements because I am using nl2br
but  the text of the announcement disappears when I use nl2br on the RSS page.

 

by: gawaiPosted on 2009-10-14 at 23:04:23ID: 25577664

nl2br will just replace new line to <br>

 

by: nanharbisonPosted on 2009-10-15 at 03:23:23ID: 25579054

But when I use it, none of the text shows on the page, so am I doing something wrong?

 

by: gawaiPosted on 2009-10-15 at 03:47:33ID: 25579161

can u  post complet code for the user inputs

 

by: nanharbisonPosted on 2009-10-15 at 03:53:11ID: 25579176

Here it is

if (isset($_POST['submit']))  // If the form was submitted, process it.
	{
 		while(list($key, $value) = each($_POST))
		{
			$value = trim($value);
			$value = mysql_real_escape_string($value);
	//echo "$key = $value<br>";
		}
	
 
	$_POST['name'] = addslashes($_POST['name']);
	$_POST['address'] = addslashes($_POST['address']);
	$_POST['title'] = addslashes($_POST['title']);
	$_POST['heading'] = addslashes($_POST['heading']);
	$_POST['announcement'] = addslashes($_POST['announcement']);
	$announcementtitle = htmlentities($_POST['title'], ENT_QUOTES, "UTF-8");
	$announcementheading = htmlentities($_POST['heading'], ENT_QUOTES, "UTF-8");
	$announcement = htmlentities($_POST['announcement'], ENT_QUOTES, "UTF-8");
 
	$startdate =$_POST['cbbstartyear'].'-'.$_POST['cbbstartmonth'].'-'.$_POST['cbbstartday'];
	$enddate = $_POST['cbbendyear'].'-'.$_POST['cbbendmonth'].'-'.$_POST['cbbendday'];
	$newenddate = daysDifference($enddate, $startdate);
 
 
	$insertannouncementquery = "INSERT into bulletinboard VALUES  ('0', '".$_POST['name']."', 
		'".$_POST['organization']."','".$_POST['email']."','".$_POST['address']."','".$announcementtitle."',		
		'".$_POST['phone']."','".$startdate."','".$newenddate."','".$announcementheading."','".$announcement."','n')";
 
	$insertquery = mysql_query($insertannouncementquery) or die (mysql_error());
	echo '<div class="alert">Your bulletin board announcement has been submitted. It will appear on the bulletin board when it is approved by CCTV. Thank you.</div>';

                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:

Select allOpen in new window

 

by: Ray_PaseurPosted on 2009-10-15 at 04:23:00ID: 25579336

Hi, Nan.  I think a better strategy would be to keep the client input as close to "stet" as possible, and only use things like htmlentities() on the output side of things.  The usual mantra is "Filter Input, Escape Output" and that would imply using nl2br() on the output side of the equation.

There is also the PHP_EOL constant that you might find useful.

I think the code segment above uses a "double escape" construction - mysql_real_escape_string + addslashes is too much.  Choose only the mysql_real_escape_string part of things.  I will post an example for you in a moment, showing how to do what you want here.

Best, ~Ray

 

by: Ray_PaseurPosted on 2009-10-15 at 05:15:56ID: 25579653

This shows the principles.  The important moving parts are mostly below lines 77.

You will have to decide what to do when a client puts in (for example) a line of data followed by a hundred "return" keys - a REGEX might help you cut this back.  And there is also the trim() function to eliminate whitespace at the beginning and end of strings.

Best of luck with your project, ~Ray

<?php // RAY_mysql_example_10.php
error_reporting(E_ALL);
echo "<pre>\n"; // READABILITY FOR EXPLICIT OUTPUTS
 
// PRESERVE LINE SPACING IN CLIENT INPUT FROM SCREEN TO DB AND BACK AGAIN
 
// IMPORTANT PAGES FROM THE MANUALS
// MAN PAGE: http://us2.php.net/manual/en/ref.mysql.php
// MAN PAGE: http://us2.php.net/manual/en/mysql.installation.php
 
// CONNECTION AND SELECTION VARIABLES FOR THE DATABASE
$db_host = "localhost"; // PROBABLY THIS IS OK
$db_name = "??";        // GET THESE FROM YOUR HOSTING COMPANY
$db_user = "??";
$db_word = "??";
 
 
 
 
// IF THERE IS NOTHING IN THE POSTED FIELD, PUT UP A FORM
if (empty($_POST["my_text"]))
{
    echo "<form method=\"post\">\n";
    echo "PLEASE TYPE INPUT HERE:\n";
    echo "<textarea name=\"my_text\"></textarea>\n";
    echo "<input type=\"submit\" />\n";
    echo "</form>\n";
    die();
}
 
 
 
// IF THERE IS SOMETHING IN THE TEXT AREA, PROCESS IT THROUGH THE DB
// OPEN A CONNECTION TO THE DATA BASE SERVER
// MAN PAGE: http://us2.php.net/manual/en/function.mysql-connect.php
if (!$dbcx = mysql_connect("$db_host", "$db_user", "$db_word"))
{
   $errmsg = mysql_errno() . ' ' . mysql_error();
   echo "<br/>NO DB CONNECTION: ";
   echo "<br/> $errmsg <br/>";
}
 
// SELECT THE MYSQL DATA BASE
// MAN PAGE: http://us2.php.net/manual/en/function.mysql-select-db.php
if (!$db_sel = mysql_select_db($db_name, $dbcx))
{
   $errmsg = mysql_errno() . ' ' . mysql_error();
   echo "<br/>NO DB SELECTION: ";
   echo "<br/> $errmsg <br/>";
   die('NO DATA BASE');
}
// IF WE GOT THIS FAR WE CAN DO QUERIES
 
 
 
 
// CREATING THE CUSTOMER TABLE SO WE HAVE A PLACE TO PUT THE DATA
$sql = "CREATE TEMPORARY TABLE customer (
        c_id   int  NOT NULL AUTO_INCREMENT,
        c_text text NOT NULL DEFAULT '',
        PRIMARY KEY(c_id)  )";
// IF mysql_query() RETURNS FALSE, GET THE ERROR REASONS
// MAN PAGE:http://us2.php.net/manual/en/function.mysql-query.php
if (!$res = mysql_query($sql))
{
    // MAN PAGE: http://us.php.net/manual/en/function.mysql-error.php
    $errmsg = mysql_errno() . ' ' . mysql_error();
    echo "<br/>QUERY FAIL: ";
    echo "<br/>$sql <br/>";
    die($errmsg);
}
 
 
 
 
 
// MAKE A LOCAL COPY OF THE VARIABLE - NEVER TOUCH $_POST AGAIN
$my_text = $_POST["my_text"];
 
// IF MAGIC QUOTES IS ON, REMOVE THE MUNG-SLASHES FROM THE DATA
if (get_magic_quotes_gpc()) $my_text = stripslashes($my_text);
 
// FOR CLARITY - SHOW THE ENTITIZED VERSION
echo "ORIGINAL DATA FROM _POST";
echo "\n1...5...10...15...20...25...30...35...40...45...50...\n";
echo htmlentities($my_text);
echo "\n1...5...10...15...20...25...30...35...40...45...50...\n";
 
// BASIC CLEANUP - STANDARDIZE END-OF-LINE
$my_text = str_replace("\r\n", PHP_EOL, $my_text);
$my_text = str_replace("\r",   PHP_EOL, $my_text);
$my_text = str_replace("\r",   PHP_EOL, $my_text);
 
// BASIC CLEANUP - ESCAPE FOR DB INPUT
// MAN PAGE: http://us2.php.net/manual/en/function.mysql-real-escape-string.php
$my_text = mysql_real_escape_string($my_text); // MUNG THE DATA
 
 
 
 
// INSERT THE DATA INTO THE DATA BASE
$sql = "INSERT INTO customer (    c_text  )
                     VALUES  ( '$my_text' )";
if (!$res = mysql_query($sql))
{
    $errmsg = mysql_errno() . ' ' . mysql_error();
    echo "<br/>QUERY FAIL: ";
    echo "<br/>$sql <br/>";
    die($errmsg);
}
 
// GET THE AUTO_INCREMENT ID OF THE RECORD JUST INSERTED
// MAN PAGE: http://us2.php.net/manual/en/function.mysql-insert-id.php
$c_id  = mysql_insert_id();
echo "\nLAST KEY: $c_id AND TEXT WITH ESCAPE STRING INCLUDED (USE \"VIEW SOURCE\" TO SEE ALL): $my_text\n";
 
 
 
 
// SELECT THE TEXT OUT OF THE DATA BASE
$sql = "SELECT c_text FROM customer WHERE c_id = $c_id LIMIT 1";
if (!$res = mysql_query($sql))
{
    $errmsg = mysql_errno() . ' ' . mysql_error();
    echo "<br/>QUERY FAIL: ";
    echo "<br/>$sql <br/>";
    die($errmsg);
}
 
// RETRIEVE THE DATA
$row = mysql_fetch_assoc($res);
$txt = $row["c_text"];
 
 
 
 
// TURN OFF THE PREFORMATTING SO WE USE THE BROWSER STANDARD
echo "</pre>\n";
 
// DISPLAY THE DATA WITH NEW LINES
echo "FORMATTED DATA USING nl2br() AFTER STORAGE AND RETRIEVAL";
echo "<br/>***********************************<br/>\n";
echo nl2br($txt);
echo "<br/>***********************************<br/>\n";
echo "<br/>\n";
 
// DISPLAY THE DATA WITHOUT NEW LINES
echo "UNFORMATTED DATA AFTER STORAGE AND RETRIEVAL";
echo "<br/>***********************************<br/>\n";
echo $txt;
echo "<br/>***********************************<br/>\n";
echo "<br/>\n";
 
 
// TRY AGAIN?
echo "<br/><a href=\"{$_SERVER['PHP_SELF']}\">TRY AGAIN</a>\n";
                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:

Select allOpen in new window

 

by: gawaiPosted on 2009-10-15 at 08:06:56ID: 25581316

its a wrong practice for the grabing users inputs...it should not be like....
$_POST['name'] = addslashes($_POST['name']);
        $_POST['address'] = addslashes($_POST['address']);
        $_POST['title'] = addslashes($_POST['title']);
        $_POST['heading'] = addslashes($_POST['heading']);
        $_POST['announcement'] = addslashes($_POST['announcement']);


change to

$name=$_POST['name']
$name=addslashes($name);
...
...and so on
u can also try with filter
$announcement = $_POST['announcement'] ;
$announcement = rssFilter($announcement);

 

by: Ray_PaseurPosted on 2009-10-15 at 08:42:32ID: 25581734

@gawai: Not sure what you mean by rssFilter()
http://us.php.net/manual-lookup.php?pattern=rssFilter&lang=en

I agree about not using $_POST directly - The PHP superglobal arrays should be an immutable, read-only variable IMHO, however it is not - thus while it may be a stylistically unpleasant choice to mung the superglobal arrays, there is nothing programatically wrong with it, from PHP's perspective.

The addslashes() function, while not yet deprecated, should always be replaced with the DB-specific escape function.  See the description here:
http://us.php.net/manual/en/function.addslashes.php

Best to all, ~Ray

 

by: gawaiPosted on 2009-10-15 at 08:48:15ID: 25581795

@ray :
rssFilter() is the user defined. i have attached the code above :)

for the rest i agree with u :)

 

by: Ray_PaseurPosted on 2009-10-15 at 08:58:35ID: 25581904

Oh, thanks.  I overlooked that.  The current PHP technology is the "filter_var" set of functions.  I would tend toward using these instead of writing my own because they will be faster (natively implemented in C) and because latent errors will be corrected by the community.  More details here:
http://us.php.net/manual/en/ref.filter.php

 

by: nanharbisonPosted on 2009-10-15 at 09:07:24ID: 25581990

I will make all these changes. It was just lazy to leave the POST variables as is.
So should I assume I can't use the nl2br on an RSS page?

 

by: Ray_PaseurPosted on 2009-10-15 at 09:15:57ID: 25582083

Well, you CAN use nl2br() - but I guess the real question would be, "Are you writing an RSS reader?"  The presentation of RSS is done by a reader.  The preparation of RSS is done by the server and the RSS is stored in a specialized XML file.  AFAIK there is nothing that prevents you from putting break tags into your XML.

 

by: nanharbisonPosted on 2009-10-15 at 09:21:54ID: 25582147

but when I used nl2br, the text disappeared, although when I viewed the source it was there.

 

by: Ray_PaseurPosted on 2009-10-15 at 09:46:24ID: 25582369

Please show us the code that gave you the disappearing text phenomenon.

Did you try the code sample I posted above?  Except for your DB vars, it is tested and working code that should demonstrate the principles.

 

by: nanharbisonPosted on 2009-10-15 at 09:59:56ID: 25582465

I already posted this code, the first bit of code in this question.

I have not implemeneted your code yet because I was waiting for an answer to the nl2br question first, and the code won't be used until someone enters an announcement on this website, which may not happen for days. Also, I work on this site in the early morning before anyone is looking at it.

 

by: Ray_PaseurPosted on 2009-10-15 at 11:02:30ID: 25583058

Sorry, I can't see anything wrong with your sites, but maybe I do not know what to look for.  If you have a test case (always a good idea) that you can use to simulate the issues, that will make the debugging process easier, and you can test any time without worrying about who is using the live version of the sites.  

I cannot answer the nl2br questions in a vacuum - "why it's not working" may not be the right question here - there are too many things wrong with the original code sample to use it in any production capacity.  I hope you can follow my example that shows the correct way to handle client text from forms and use nl2br() correctly.  If you have any questions about that, please post back here.  

Best of luck with it, ~Ray

 

by: nanharbisonPosted on 2009-10-15 at 13:27:22ID: 31641184

Thanks guys, I am getting going on this and will then hope the nl2br works!

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...