Oh, I see.  I already saw that thread but didn't know how to use it for my case.  Now I see the thing to do is to convert all the \n to <br />, then add the paragraphs -- two steps.  Thanks a lot.


Gosh, you're so smart.  Guess that's why they call you that.


This sounds easier to do that I expected it to be.  PHP continually amazes me at how easy it is to use.  I'll let you know how it goes.  Thanks again.

Text for a webpage is stored in a MySQL database.  In the database, the text is grouped into paragraphs that are separated by linebreaks.  How do you take that text from the database and add the HTML tags so that it displays on the webpage properly?

adding <br /> for a single linebreak,

and adding
</p>
<p> for two linebreaks in a row.

If I'm going about this wrong then please correct me.  Basically what I'm trying to do is learn how to make my database text display on a webpage with the correct HTML tags.

I did this about a year ago for the news feeds on FreeSquid.org.  Things may have changed since then, but at the time these were good:

* SitePoint tutorial on Parsing RSS 1.0 -- http://www.sitepoint.com/article/php-xm … ng-rss-1-0
* MagpieRSS parser (sourceforge) -- http://magpierss.sourceforge.net/
* MyHeadlines webscraper (sourceforge) -- http://sourceforge.net/projects/myheadlines/

(edited)
Oh wait -- you want to create a feed.  Sorry, I misunderstood.  In that case, try reading the post in the thread I mentioned earlier where the guy (Kev) gives the basic code for writing your own feed.  You also might try studying the feed generator for punBB.  I think it's in the extern.php file.

29

(67 replies, posted in News)

But now with the pressure to be cool, that may all change:

I hope you're running PunBB 1.2.8. It's what all the cool people are doing.

30

(67 replies, posted in News)

badrad wrote:

This constant attention is definitely a good thing, even though it shows how lazy I am. My Punbb is a franken 1.5 beast. I am still procrastinating a proper update as I know I'll have to rewrite a bunch of my forum anyway.

Lazyness!

You and me both!  I'm still on 1.5.1 -- it's so old that the process of updating it involves several extra steps that sound intimidating (plus maybe I'm a little bit lazy wink).

31

(19 replies, posted in Programming)

I have a simple events calendar set up:  http://tuckertoday.com/events/
*  The tables were created by writing a query and entering it through phpMyAdmin;
*  Data was entered manually through phpMyAdmin (I'll create a webform later);
*  and Results are displayed on the webpage using some basic MySQL and PHP commands.

My question is:
For a large block of text that includes several parapraphs, linebreaks, lists, links, etc, how should the HTML tags be added to the data?  I think I understand in theory what I should do -- the data from the database gets processed through a RegExp and/or parser.php and linebreaks are converted to BR tags and BBCode is converted to other tags.  Something like that anyway.  Can anyone give me some pointers?  I'll study the punBB source to see how it does it, but some guidance would be appreciated because I'm still new at this.

Related Threads:
Reg Exp -- http://punbb.org/forums/viewtopic.php?id=8899

-

32

(19 replies, posted in Programming)

Oh, that is so simple.  Thanks!

33

(33 replies, posted in News)

Thanks, CodeXP.

Rickard wrote:

http://www.funwithmsn.com/msnsmileys/ki … ushing.gif

Edit: Fear not, the above is not a PunBB smiley.

That reminds me, I need to add more smileys to my forum.

34

(19 replies, posted in Programming)

I'm having trouble figuring out TIMESTAMPs.
I want to create a table with a `posted_on` column and an `edited_on` column.  The first one would be set once and stay that value (not auto-update), and the second one would begin with no value and only get the current timestamp if the row is updated.  It seems a simple thing to ask, but I've spent hours studying the online manual and it still doesn't make sense.

What's a good way to do it?  This is my latest guess:

Create the table with these:
`posted_on` TIMESTAMP NULL DEFAULT 0,
`edited_on` TIMESTAMP NULL DEFAULT 0,

And insert values when posting or editing with:
INSERT INTO t2 VALUES (CURRENT_TIMESTAMP);

So there's no more auto-updating; it just updates when a query tells it to.

35

(33 replies, posted in News)

How do you type '»'?  I noticed it's used in the breadcrumb trail.  I thought there might be an ascii code for it, but everytime I find it on a website and view source it's simply typed in.  What's the secret keyboard combination for typing it?  wink  Offtopic, I know -- thanks though.

36

(33 replies, posted in News)

But wait!  I never got around to upgrading to 1.2.6 -- I missed out. sad

It does NOT require MySQL or other database programs since all image information is stored in flat text CSV files (although an optional MySQL backend is planned for a future release).

http://singapore.sourceforge.net/?page=features

That bothers me.  Flat-file databases are a waste of resources.  I'd rather use a MySQL database.  Singapore doesn't work in mysql yet, does it?

Which of the many Photo Galleries is considered "best"?  It sounds like the top 2 are Gallery and Coppermine.  I'm looking for something that's coded well and is secure -- something comparable to punbb and wordpress.  I've heard of Gallery having security issues so I'm leaning towards Coppermine at the moment.

39

(71 replies, posted in News)

I'm pleased to announce the release of PunBB 1.2.6.

Yeah!  smile  I've been looking forward to this.  I think now I'll go ahead and upgrade from 1.1.5, as well as install one or two new forums that have been in the works for several months.  I really have been looking forward to the 1.2.6 upgrade.  Thanks very much.

In Soviet Russia, road forks you!

OK, what's that all about?  It's the second time I've seen that joke -- the other one was, "In Soviet Russia... Websites develop YOU!".

(I like your idea of having a standard set of 'necessary mods'.)

41

(19 replies, posted in Programming)

I read your blog entry on FreeBSD.  Interesting stuff -- I might actually try that someday.

42

(19 replies, posted in Programming)

I should probably buy a book an MySQL and learn some database basics.  I've gotten by mostly on guessing up to this point. wink

43

(67 replies, posted in News)

Any word on a potential 1.2.6 coming out soon?

44

(67 replies, posted in News)

Thanks.  I just read your post again and it makes sense now -- didn't pay enough attention the first time I read it.  What you say to do seems obvious now.

Download PunBB 1.2 and copy over all your files with those
Get the 11_to_12_update.php script and run it
Download PunBB 1.2.5, overwrite the files, and run the update script in the extras folder there

45

(67 replies, posted in News)

I've also been a very bad forum admin.  The version I'm running is 1.1.5 -- is there any trick or potential problem to upgrading to 1.2.5?  Or do you think it should go smoothly if I simply follow the directions that come with 1.2.5 for upgrading?

46

(67 replies, posted in News)

I guess what I'm really asking is, is 1.2.5 stable enough to install and use for a while?  Or should I wait for another release that might be coming out soon?

47

(67 replies, posted in News)

Rickard wrote:

Two bugs have surfaced since the release of 1.2.5. To fix these bugs, apply the following changes:
http://dev.punbb.org/changeset/172
http://dev.punbb.org/changeset/173

I might release a revised version or fix up some other things I have piled up and release 1.2.6.

Did you ever have a chance to add the changes to 1.2.5?  Or do we still need to do them ourselves.  Or maybe 1.2.6 is coming out in the next couple of days?  Just curious.

48

(19 replies, posted in Programming)

Something like this?  (a lookup table that lists the categories for each event)

'events'
ID     Event_date  Etc
1             -
2             -
3             -
4             -

'categories'
ID   Category
1    meeting
2    festival
3    tca

'event_category_lookup'
Event_ID     Category_ID
1             1
1             3
2             2
2             3

49

(19 replies, posted in Programming)

In other words, what is a good way to set up the table in order to sort by category?

cat=meeting => 1,2
cat=cmnty    => 1,3
etc

If anyone understands databases better than I do, I'd appreciate some help.  Thanks.

50

(19 replies, posted in Programming)

What's a good way to set up the database for multiple categories?  I'm writing a cms for an events calendar.  Each event falls in any of several categories.  What's the best way to set up the database table so that it can be sorted by category? 

* One column with each row containing a list of categories (separated by commas or whatever)?
* One column with each row containing a list of category_ids (and a separate table 'categories')?
* One column for each category, containing the value 1 or 0?

Example:

id | date | location | category        | moderators
```````````````````````````````````````````````````
1  |      |          |meeting,cmnty,tca|                 
2  |      |          |meeting,tca      |   
3  |      |          |festival,comnty  |