PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Thu May 25, 2017 3:03 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 21 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: Simple BBTag Parser
PostPosted: Wed Sep 10, 2008 8:07 pm 
Offline
Forum Newbie

Joined: Wed Sep 10, 2008 8:03 pm
Posts: 1
hi new to this site

how could i impliment this code into nanocms?

my php knowlage isnt great.

this is the code that puts the text on the page

Syntax: [ Download ] [ Hide ]
 
function show_content_slug()
{
    global $cap;
    $slug = $cap->slug;
    $contentFile = pageDataDir( $slug );
    if( file_exists( $contentFile ) ) {
        runTweak( 'slug_load_before' );
        require_once( $contentFile );
        runTweak( 'slug_load_after' );
    }
    else {
        header("HTTP/1.0 404 Not Found");
        echo "404 : File Requested was Not Found";
    }
}
 


thanks in advance
sean


Top
 Profile  
 
 Post subject: Re: Simple BBTag Parser
PostPosted: Sat Feb 13, 2010 11:30 pm 
Offline
Tranquility In Moderation
User avatar

Joined: Sun Feb 06, 2005 8:18 pm
Posts: 5001
Location: Indiana
Hey Chris,

I am using your BBCode parser (posted on page one, after mine).. works great! Yours is way better. I've extended the functionality to include size, color, center, right, marquee, and youtube (you know, annoying things)

However I've noticed that if a certain tag doesn't have the correct opening and closing tags, none of the same tags will get parsed. Is this easily fixable?

I've tried for days now but no luck. It is a bit complicated (for me).

For example:

Syntax: [ Download ] [ Hide ]
[ i ]italics[ /i ] [ i ] no closing tag here


This would not parse anything although I believe the first one should be parsed.

I tried editing the checkClosure() method to add tags that were open.. but no luck :(

_________________
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.


Top
 Profile  
 
 Post subject: Re: Simple BBTag Parser
PostPosted: Mon Feb 15, 2010 4:00 pm 
Offline
Site Administrator
User avatar

Joined: Wed Aug 25, 2004 7:54 pm
Posts: 13396
Location: New York, NY, US
I don't think Corbyn checks in much these days. From looking at his code, I don't think malformed tags like "[ i ]" will work.

_________________
(#10850)


Top
 Profile  
 
 Post subject: Re: Simple BBTag Parser
PostPosted: Tue Feb 16, 2010 1:52 pm 
Offline
Tranquility In Moderation
User avatar

Joined: Sun Feb 06, 2005 8:18 pm
Posts: 5001
Location: Indiana
I did that so the board wouldn't parse it

but i wrote my own parser that will just match the start tag through to the end tag and replace

_________________
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.


Top
 Profile  
 
 Post subject: Re: Simple BBTag Parser
PostPosted: Wed Feb 17, 2010 11:31 pm 
Offline
DevNet Master

Joined: Wed Feb 11, 2004 4:23 pm
Posts: 4872
Location: Palm beach, Florida
Surely there is lots that could be re-factored, but since when has BBcode had to change? If it aint broke don't fix it! (if it has to be changed often then by all means refactor the hell out of it)
-- directed at @arborint (even tho your response are excellent advice for learning about refactoring & good practices)

Based on that note I'd change the find & replace arrays to be only ONE array, and use key() and current() to read them out. That way you don't have to jump like 20 lines of code to match them up

array(
'find1',
'find2'
)

array(
'replace1'
'replace'2
)

change to

array(
'find1' => 'replace1',
'find2' => 'replace2'
)

Image


Top
 Profile  
 
 Post subject: Re: Simple BBTag Parser
PostPosted: Sun Aug 01, 2010 12:20 pm 
Offline
Forum Newbie

Joined: Sat Jul 31, 2010 7:15 am
Posts: 10
While designing a good layout for a webpage, sometimes we need to convert bbcode tag to html and vice versa. Thanks for such simple and yet simple bb tag parser to convert common bb tags to html, and vice versa. Wish you best of luck as a professional coder.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 21 posts ]  Go to page Previous  1, 2

All times are UTC - 5 hours


Who is online

Users browsing this forum: Majestic-12 [Bot] and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group