Jump to content

Building A Forum


chibineku

Recommended Posts

I've set myself the task of building a forum. By the time I can do that, I reckon I'll be able to do most anything that a web designer is required to do (or at least have the confidence in my own ability to learn). But it's a pretty daunting task. Has anyone here made one? If so, where did you start and do you have any pointers for direction?I notice when navigating around this forum that every page is some kind of extension of index.php, and on a brief look at the source, every element, even loading pages, seem to be coded into index.php. Which begs the question, how many actual pages are there? Do the php pages just adjust the content of the one index page? I am brand new to php, so the learning curve there will be the steepest, that and databases. I have enormous books on them though...reassuringly, terrifyingly, enormous.

Link to comment
Share on other sites

I did make one once, but it was pretty difficult to manage and the code was a little too encrusted with the presentation. But that was a long time ago. I could do a much better job if I set out to make one now.Depending on how the forum is built, it can all be using one page, or it can use several. Basically all of them have a template system, in which they extract the HTML from separate files and then add the dynamic information where necessary.But forums are really complex applications. If you're new to PHP I do not recommend trying to build one. Try making a guestbook or a simple user login system instead.

Link to comment
Share on other sites

A single 'index.php' page is quite common using server-side scripting. Inside the index page there would be a logic trap of some sort to determine the contents to display on the page based on the values found in the 'Query string', like index.php?p=about&t=web could display the web-design background for a user. Here is the code from a 'modular' design for a single php page:

// Validate what page to show:if (isset($_GET['p'])) {	$p = $_GET['p'];} elseif (isset($_POST['p'])) { // Forms	$p = $_POST['p'];} else {	$p = NULL;}// Determine what page to display:switch ($p) {	case 'about':		$page = 'about.inc.php';		$page_title = 'jlh Designs ~ About';		break;	case 'contact':		$page = 'contact.inc.php';		$page_title = 'jlh Designs ~ Contact';		break;		case 'search':		$page = 'search.inc.php';		$page_title = 'jlh Designs ~ Search Results';		break;		// Default is to include the main page.	default:		$page = 'main.inc.php';		$page_title = 'jlh Designs _ Index';		break;		} // End of main switch.// Make sure the file exists:if (!file_exists('./modules/' . $page)) {	$page = 'main.inc.php';	$page_title = 'jlh Designs ~ Main';}// Include the header file:include_once ('./includes/header.html');// Include the content-specific module:// $page is determined from the above switch.include ('./modules/' . $page);// Include the footer file to complete the template:include_once ('./includes/footer.html');

Notice how the switch Logic structure 'includes' a file? (it can also include 'sub-scripts'). The title is used inside the Header file as the page header for display. The specific module files can perform further processing of the Query string for determining how or what to display on the pages. Example, in the About page, you might have several sources of information and depending on the value of a different piece of the Query string, display the correct one. ie: "t=web"I am familiar with the AEF Forum software and I would urge you to download a copy and check out the index page for that software to see how it uses the query string to process the Forum. Download link is in my siggy. If you are keen to write your own Forum, fine, but there are several out there already that would appreciate some assistance with coding Mods, etc. *hint*

Link to comment
Share on other sites

Well, obviously I'll build up...start with logging in, then tracking sessions, then perhaps a guestbook and build that into one forum... How experienced when you made yours? I think, obviously, I will just start with getting the layout working. I may use javascript to imitate the php scripts so that I can have all the content in the one page, with buttons merely hiding or revealing divs and layers and gradually replace the JS with real PHP functions. Given that I have never done anything complex with CSS, layout will be a pretty decent first challenge :) .

Link to comment
Share on other sites

The time I made my forum I already had a whole lot of PHP experience. I just didn't think of a good way to organize everything, but I know it worked and was secure, since I had already learnt hashing and string escaping. I even had an AJAX preview system for previewing posts.I don't have the files for the forum anymore, they weren't very important to me. I'd rather start from zero if I wanted to build another forum. I currently prefer to use other forum software than making my own. I can make changes to it as I want, and I don't have to build the entire system on my own.

Link to comment
Share on other sites

If you are keen to write your own Forum, fine, but there are several out there already that would appreciate some assistance with coding Mods, etc. *hint*
Hey, thanks for the info. I've DLed the forum and will study all the bits tomorrow. I don't think I'd be much use to anyone at the moment, unless it's to do some pretty basic javascripts. It'd take longer getting me up to speed than doing it yourself. But if you want to try me, go for it - I am looking for a place to start learning...well, anything useful at all and I have all the time in the world to research it right now.
Link to comment
Share on other sites

The time I made my forum I already had a whole lot of PHP experience. I just didn't think of a good way to organize everything, but I know it worked and was secure, since I had already learnt hashing and string escaping. I even had an AJAX preview system for previewing posts.I don't have the files for the forum anymore, they weren't very important to me. I'd rather start from zero if I wanted to build another forum. I currently prefer to use other forum software than making my own. I can make changes to it as I want, and I don't have to build the entire system on my own.
That's fair enough, I suppose, but I want to know that I can do it, then I'll happily just mod an existing design. Web design, while still pretty new to me, is the first thing that has really captured my interest for a long time, and I'm 25 with a pretty useless English degree, so I'm looking for something to do for a living and quick-smart. Without getting any sort of qualification in web design, I want to create something complex and, eventually, impressive to use as an advert, basically. I reckon it's one of the few fields that you can move into without formal education based solely on what you can prove youself capable of. Plus, once I have a nice working forum, I can use it as a model for any future ones, which means if someone wanted a forum made, it should be a snap...a matter of a few CSS files. Anyway, that's my mini-bio for today.
Link to comment
Share on other sites

I'll guarantee that virtually anything you do during your first year or two of learning how to program is basically throw-away work, it's only useful for the experience. I would never re-use anything from when I first started with PHP, it would almost be more efficient (and definitely easier to maintain) if I just re-wrote it with what I know now. That actually happens every few years, every now and then I hit a point where the things I'm working on are night and day versus the things I was working on a few years ago. In fact, even the things I'm working on today are in a completely different league than anything I was capable of when I signed up here, and even then I already had a few years of experience. So don't expect your first applications to be worthy of sticking on your resume, after you've been programming for a few years you'll actually be embarassed to show that early stuff.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...