Charas-Project

  • Home
  • Help
  • Search
  • Calendar
  • Login
  • Register
*
Please login or register.

Login with username, password and session length
 

News:

New forum theme up and running!



  • Charas-Project »
  • Off-Topic »
  • Archive »
  • Really Old Stuff »
  • PHP (Moderator: De KoFfieŠ) »
  • Forum Questions
« previous next »
  • Print
Pages: [1]

Author Topic: Forum Questions  (Read 3237 times)

Offline GaryCXJk

  • <strong>Official Charas.EX Team Member</strong>
  • Exemplar
  • *
  • Posts: 1,586
  • FOUR OH FOUR'D
    • Multiverse Works
Forum Questions
« 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?
Logged

Play it now! Charas Breakout DX
Area91: for MUGEN and RPG Maker VX Ace stuff

Offline Alex

  • I am the MASTER!
  • Administrator
  • Exemplar
  • *
  • Posts: 1,130
(No subject)
« Reply #1 on: December 21, 2003, 03:08:39 AM »
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]", "<i>", $bericht);

$bericht = eregi_replace("(^|[>[:space:]\n])([[:alnum:]]+)://([^[:space:]]*)([[:alnum:]#?/&=])([<[:space:]\n]|$)","\\1<a href=\"\\2://\\3\\4\" target=\"_blank\">\\2://\\3\\4</a>\\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 : <b>";
for (
$i = 1; $i <= $num_pages; $i++) {
if (
$i != $page) {
echo 
"thelink.php?page=$i>$i</a> ";
} else {
echo 
"$i ";
}
}
}


3) read  here
Logged

  • Print
Pages: [1]
« previous next »
  • Charas-Project »
  • Off-Topic »
  • Archive »
  • Really Old Stuff »
  • PHP (Moderator: De KoFfieŠ) »
  • Forum Questions
 

  • SMF 2.0.10 | SMF © 2015, Simple Machines
  • XHTML
  • 2O11
  • RSS
  • WAP2
  • Simple Machines Forum