Charas-Project
		Off-Topic => Really Old Stuff => Archive => PHP => Topic started by: GaryCXJk on December 05, 2003, 02:51:37 PM
		
			
			- 
				Well, I have some questions regarding the forum. I'm making one myself, with own portal and own stuff.
 
 Anyways here are the questions:
 
 1) How were the tags done? Did DeKoffie used $preg_replace? Can you give me an example of the italic tags?
 
 2) How were the page systems done? Like, if there are more than 15 posts, then you can click on a certain page to go to for example page 16 to 30.
 
 3) What is that TYPE=MyISAM; used for in MySQL?
- 
				Soryy for replying so late, anyhow here i am! ;)
 
 1) italic is easy, so i'll show also the examples of auto links and PHP code:
 
 $bericht = str_replace("[I]", "", $bericht);
 
 $bericht = eregi_replace("(^|[>[:space:]\n])([[:alnum:]]+)://([^[:space:]]*)([[:alnum:]#?/&=])([<[:space:]\n]|$)","\\1\\2://\\3\\4\\5", $bericht);
 
 $bericht = preg_replace('_\[PHP\](.*?)\[/PHP\]_ise', "highlight(trim(stripslashes(' \\1 ')))", $bericht);
 
 
 
 2) simply count the total posts at the beginning, then read you "howmanyperpage" var and split it.
 Example:
 
 $total=43;
 $perpage=15;
 $actualpage=2;
 $pagestart = ($perpage * $actualpage) - $perpage;
 $pages=intval($total/$perpage)+1; //will be 3
 
 
 Then add this to you sql query:
 LIMIT $pagestart, $perpage
 
 And create the "pages" link like this:
 
 if($num_pages > 1) {
 echo "Pages : ";
 for ($i = 1; $i <= $num_pages; $i++) {
 if ($i != $page) {
 echo "thelink.php?page=$i>$i ";
 } else {
 echo "$i ";
 }
 }
 }
 
 
 3) read  here (http://www.mysql.com/doc/en/MyISAM.html)