Log in

View Full Version : Puzzled by parse_bbcode function - help :(


cinq
11-26-2004, 08:03 AM
I can trying to parse the content using the parse_bbcode function.
However the page is loading very slow because of the parsing , and I cannot figure out why.
If I use the bottom code instead ( ie. dont parse but the result is not what I want ), the page loads fast.

How come ?


$newsmain['content'] = parse_bbcode($newsmain['content'], '1', 1, 0, '', 1, 0);
$newscontent = $newsmain['content'];


vs.


$newscontent = $newsmain['content'];

Revan
11-26-2004, 12:03 PM
Hm, I would suggest using the parse_bbcode2 function. I do not know the difference, I just know that using the bbcode2, it takes alot less arguements than that above there, and it loads fast enough.

:)

burnist
11-26-2004, 04:24 PM
Turn your vB into Debug mode and have a look at the secret settings in there. That should tell you why bbcode_parse should not be used and bbcode_parse2 should

cinq
11-26-2004, 11:44 PM
What debug mode ?

Anyways, I tried this :

$newsmain['content'] = parse_bbcode2($newsmain['content'], 0, 1, 1, 1, 0, 1);

But it still is the same case of slow loading.

What am i doing wrong ?

Revan
11-27-2004, 03:01 PM
heres a small snippet of code from the RPG Integration Hack:
parse_bbcode2($battletext, 0, 0, 1, 1);
It does not parse HTML
It does not parse IMG
It parses smileys
It parses BBCode

You do not need to set the two final attributes in your parse_bbcode, because the values you input are the same as vB has for default.



//peace

cinq
11-27-2004, 11:41 PM
Revan, even doing that I still face the same problem.
That's why I am puzzled.
There seems nothing wrong with the querying.

Brad
11-29-2004, 06:16 PM
Hm, I would suggest using the parse_bbcode2 function. I do not know the difference, I just know that using the bbcode2, it takes alot less arguements than that above there, and it loads fast enough.

:)
parse_bbcode is used with a cache like the posting cache. If done correct with a cache you can avoid having the parse bbcode on everypage view.

parse_bbcode2 takes raw vBcode and converts it to html for the browser when the page is called. It also dose image checking if allowed.

parse_bbcode is used to pass raw html built by parse_bbcode2 to the browser while still checking it for permissions. By storing the html in a mysql table on the first page view and calling it on all page views afterwards you avoid multiple preg_replace function calls, and save alot of generation time.

cinq
11-29-2004, 11:43 PM
Brad, so how does that fix my problem ? :D