473,425 Members | 1,788 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,425 software developers and data experts.

how do we make threads like they do in IPB

realin
254 100+
hey guys,

Well i was just thinking that how to make threads like stufff at my own. Suppose i am posting here this question, now a new html will be generated and later on the answers will be concatenated..

I mean how do it do that ?

the approach that i used was like this ::

made two tables
1) Questions
2) Answers

one stores teh questions asked and are trailed by the answers given..
Now i used to display using the query string like http://domain.com/action=view&post=9

but is it a right appraoch, cause lotsa forums rather i can say every forum uses html pages to display and the page has a unique number, i am sure these html pages are generated dynamically from one page..

but how to go along with it ..

i hope i made everything clear..
thanks in advance :)
Sep 20 '07 #1
6 3004
pbmods
5,821 Expert 4TB
Heya, Realin.

Likely, the unique ID represents the ID of a record in a database.

For example, if you were to have a URL such as:
Expand|Select|Wrap|Line Numbers
  1. http://yoursite.tld/path/to/quiz.php?question=9
  2.  
Then you'll probably find something like this in quiz.php:
Expand|Select|Wrap|Line Numbers
  1. if( ! empty($_GET['question']) )
  2. {
  3.     $_question = (int) $_GET['question'];
  4. }
  5.  
  6. if( empty($_question) or $_question < 1 )
  7. {
  8.     echo 'Invalid question.';
  9.     exit;
  10. }
  11.  
  12. $_res = mysql_query("
  13. SELECT
  14.         *
  15.     FROM
  16.         `questions`
  17.     WHERE
  18.         `questionid` = '{$_question}'
  19.     LIMIT 1");
  20. .
  21. .
  22. .
  23.  
Sep 20 '07 #2
realin
254 100+
Heya, Realin.

Likely, the unique ID represents the ID of a record in a database.

For example, if you were to have a URL such as:
Expand|Select|Wrap|Line Numbers
  1. http://yoursite.tld/path/to/quiz.php?question=9
  2.  
Then you'll probably find something like this in quiz.php:
Expand|Select|Wrap|Line Numbers
  1. if( ! empty($_GET['question']) )
  2. {
  3.     $_question = (int) $_GET['question'];
  4. }
  5.  
  6. if( empty($_question) or $_question < 1 )
  7. {
  8.     echo 'Invalid question.';
  9.     exit;
  10. }
  11.  
  12. $_res = mysql_query("
  13. SELECT
  14.         *
  15.     FROM
  16.         `questions`
  17.     WHERE
  18.         `questionid` = '{$_question}'
  19.     LIMIT 1");
  20. .
  21. .
  22. .
  23.  

hey thanks for the reply..
i have already implemented this logic but i am kinda not satisfied with it.. though i think its not the proper technique.. cause in all the boards what i saw is pages are like http://domain.com/index623612.html unlike the one i am making as http://domain.com/action=view&p=9

i hope now i make this think clear
Sep 21 '07 #3
pbmods
5,821 Expert 4TB
Heya, Realin.

Many sites make use of URL rewriting such that it appears that each record gets its own page, even though it is not the case.

For example, you might type this into your address bar:
http://www.thescripts.com/forum/thread711214.html

But it actually gets rewritten server-side to:
http://www.thescripts.com/forum/showthread.php?t=711214
Sep 21 '07 #4
realin
254 100+
hi sorry for the late reply, actually i am on travel.. i just wanted to know that URL rewriting can only be done with apache, after editing httpd.conf ? in some tutorials i read i gotta load the rewrite_module and add it.. but when i install the "phpBB" on the same machine the same kind of url(mentioned above) is shown.. i mean how is it possible..
i have used http://www.thescripts.com/forum/thread711214.html to reach this thread meaning the number 711214 does have some significanse and is stored somewhere in the database.. that is why it landed me to a correct thread..

while reading tutorials i realized that url rewriting helps search engine friendlu urls and also hides the under lying web techonolgy used, which apparently is true.. but still i am unable to achieve it..
can you clear my doubts a bit.. thanks :)
Sep 22 '07 #5
bergy
89
I normally use .htaccess files to rewrite URLs. You don't have to modify your httpd.conf file and it can be done per directory in case you have multiple sites on your server.

The trick is to make sure that mod_rewrite is enabled in apache and also there is another config option I ran into (can't remember exactly what it's called) that will try to guess which file you're trying to get if you typed something wrong... so say you try to goto domain.com/pictures and there is no pictures directory but there is a pictures.html apache will return that .html file. So, in short, make sure that option is turned off in your config - sorry I can't remember.

Anyway, here is a sample of one of my .htaccess files:

Expand|Select|Wrap|Line Numbers
  1. RewriteEngine on
  2.  
  3. RewriteRule ^([A-Za-z0-9-]+)/?$ index.php?site_action=$1 [L]
  4.  
The above rule is placed in .htaccess in the main directory of my website. If someone goes to mysite.com/home apache pulls up mysite.com/index.php?site_action=home without changing the address bar. One thing to remember, if you're using relative links in your images like:
Expand|Select|Wrap|Line Numbers
  1. <img src="images/image.jpg">
Your images won't display because your browser thinks that you are in a subdirectory (home in my example above) so it looks for "mysite.com/home/images/image.jpg". To fix this, put a leading slash in front of the image:
Expand|Select|Wrap|Line Numbers
  1. <img src="/images/image.jpg">
Remember this for any type of link/file you're referencing, a javascript, style sheet, flash movie, etc. Always have that leading slash so the server knows to start at the root of the web server.

Also, ilovejackdaniels.com has a great mod_rewrite cheatsheet. Check that out for a quick reference -- http://www.ilovejackdaniels.com/chea...e-cheat-sheet/

Thescripts.com rewrite script probably looks something like this for their forum redirects:
Expand|Select|Wrap|Line Numbers
  1. RewriteEngine on
  2.  
  3. RewriteRule ^thread([0-9-]+).html?$ showthread.php?p=$1 [L]
  4.  
Sep 22 '07 #6
realin
254 100+
I normally use .htaccess files to rewrite URLs. You don't have to modify your httpd.conf file and it can be done per directory in case you have multiple sites on your server.

The trick is to make sure that mod_rewrite is enabled in apache and also there is another config option I ran into (can't remember exactly what it's called) that will try to guess which file you're trying to get if you typed something wrong... so say you try to goto domain.com/pictures and there is no pictures directory but there is a pictures.html apache will return that .html file. So, in short, make sure that option is turned off in your config - sorry I can't remember.

Anyway, here is a sample of one of my .htaccess files:

Expand|Select|Wrap|Line Numbers
  1. RewriteEngine on
  2.  
  3. RewriteRule ^([A-Za-z0-9-]+)/?$ index.php?site_action=$1 [L]
  4.  
The above rule is placed in .htaccess in the main directory of my website. If someone goes to mysite.com/home apache pulls up mysite.com/index.php?site_action=home without changing the address bar. One thing to remember, if you're using relative links in your images like:
Expand|Select|Wrap|Line Numbers
  1. <img src="images/image.jpg">
Your images won't display because your browser thinks that you are in a subdirectory (home in my example above) so it looks for "mysite.com/home/images/image.jpg". To fix this, put a leading slash in front of the image:
Expand|Select|Wrap|Line Numbers
  1. <img src="/images/image.jpg">
Remember this for any type of link/file you're referencing, a javascript, style sheet, flash movie, etc. Always have that leading slash so the server knows to start at the root of the web server.

Also, ilovejackdaniels.com has a great mod_rewrite cheatsheet. Check that out for a quick reference -- http://www.ilovejackdaniels.com/chea...e-cheat-sheet/

Thescripts.com rewrite script probably looks something like this for their forum redirects:
Expand|Select|Wrap|Line Numbers
  1. RewriteEngine on
  2.  
  3. RewriteRule ^thread([0-9-]+).html?$ showthread.php?p=$1 [L]
  4.  

hey man,

thanks a lot, would check that soon.. its really informative really really thanks a lot, have kept it for future reference too :)

thanks once again
Sep 23 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

22
by: Jeff Louie | last post by:
Well I wonder if my old brain can handle threading. Dose this code look reasonable. Regards, Jeff using System; using System.Diagnostics; using System.IO; using System.Threading;
6
by: RahimAsif | last post by:
Hi guys, I would like some advice on thread programming using C#. I am writing an application that communicates with a panel over ethernet, collects data and writes it to a file. The way the...
11
by: mareal | last post by:
I am trying to write a basic load balancer (in our web service) solution. The purpose of this load balancer is to keep an array updated with server status. We have several servers that can be...
35
by: Carl J. Van Arsdall | last post by:
Alright, based a on discussion on this mailing list, I've started to wonder, why use threads vs processes. So, If I have a system that has a large area of shared memory, which would be better? ...
9
by: bonk | last post by:
Does anyone have a simple example on how to prohibit that any thread other than the current thread modifies a certain object (a collection) while we are in a certain section of the code? In other...
4
by: gsimmons | last post by:
I've been researching multi-threaded WinForms apps and thread synchronization stuff for a couple days since I'm working on refactoring a multi-threaded GUI app at work and want to be sure it's...
10
by: =?Utf-8?B?UHVjY2E=?= | last post by:
Hi, I'm using vs2005 and .net 2.0. I started 2 threadpool threads. How do I know when they're done with their tasks? Thanks. ThreadPool.QueueUserWorkItem(new...
3
by: JohnM | last post by:
Hi there, Are there any specific rules or best-practices I should be aware regarding events and the threads they're fired on. Object 1 can be created on thread 1 for instance and an event then...
18
by: Jon Slaughter | last post by:
"Instead of just waiting for its time slice to expire, a thread can block each time it initiates a time-consuming activity in another thread until the activity finishes. This is better than...
167
by: darren | last post by:
Hi I have to write a multi-threaded program. I decided to take an OO approach to it. I had the idea to wrap up all of the thread functions in a mix-in class called Threadable. Then when an...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.