[solved] php highlight function help

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Post by Kieran Huggins »

now I'm hungry for popcorn... :-( Let the flogging begin! (and some lashing, just in case)
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Okay, enough ribbing.
ziggy3000
Forum Contributor
Posts: 205
Joined: Fri Mar 23, 2007 3:04 pm

Post by ziggy3000 »

aaronhall wrote: Also, I know a few here already apologized, but I wanted to say sorry myself for all of the code we didn't write for you, and for not going above and beyond to spoon-feed you answers. As many of the people in this community have spent years learning the language themselves, I speak for all of us what I say that we regret not jumping all over the opportunity fix your problems without anything in return, and not going out of our way to make sure you learn absolutely nothing. How harebrained of us to think that you should be expected to try things for yourself; how selfish of us to have expected you to utilize resources that are already freely available on the internet. Please accept our heartfelt and sincere apologies.
it's okay. i understand your just trying to help, but i do expect someone to be really helpful and post some code once in a while...

and i don't need pear just yet... i am going to get another pc, and triple boot Ubuntu, vista and xp, so if it doesn't work on windows, ill try Ubuntu.
ziggy3000
Forum Contributor
Posts: 205
Joined: Fri Mar 23, 2007 3:04 pm

Post by ziggy3000 »

ok i dont know how to implement my highlight function into the cbparser

heres the code

Code: Select all

<?php
	/*
		syntax highlighting (Cool Colored Code™)
		och, why not!
		*/
	$ccc = array(); $i = 0;
	while ($ccc_str = stristr($bb2html, '[ccc]')) {
		$ccc_str = substr($ccc_str, 0, strpos($ccc_str, '[/ccc]') + 6);
		$bb2html = str_replace($ccc_str, "***ccc_string***$i", $bb2html);
		$ccc[$i] = str_replace("\r\n", "\n", $ccc_str);
		$i++;
	}
?>
first of all i want it

Code: Select all

 not [ccc][/ccc]
i just replaced all ccc's with php but then i  am confused on using my function instead of the one thats included

heres the code i want replaces with

[b]Edited: I Solved it. Dont need help anymore.[/b]
Last edited by ziggy3000 on Fri Apr 13, 2007 4:08 pm, edited 2 times in total.
ziggy3000
Forum Contributor
Posts: 205
Joined: Fri Mar 23, 2007 3:04 pm

Post by ziggy3000 »

Everah, can you help me?
or anyone else that knows how to please help
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

I am working on a corz blog bbcode parser fork at the moment. It works, but it is really rough.
ziggy3000
Forum Contributor
Posts: 205
Joined: Fri Mar 23, 2007 3:04 pm

Post by ziggy3000 »

anyone else???
it's not like that everah is the only smart one here
is it?
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Yeah, there has got to be someone else smarter than me around here that can do this for ziggy. :roll:
ziggy3000
Forum Contributor
Posts: 205
Joined: Fri Mar 23, 2007 3:04 pm

Post by ziggy3000 »

guess everah is the smartest one here :roll:
User avatar
aaronhall
DevNet Resident
Posts: 1040
Joined: Tue Aug 13, 2002 5:10 pm
Location: Back in Phoenix, missing the microbrews
Contact:

Post by aaronhall »

ziggy3000 wrote:guess everah is the smartest one here :roll:
You're awfully sassy for a guy that needs help so desparately :) I don't think that's what he meant anyway.
ziggy3000
Forum Contributor
Posts: 205
Joined: Fri Mar 23, 2007 3:04 pm

Post by ziggy3000 »

i just want to get it to work, since i am trying to code other stuff(it's coming along very well) and i need to replace the functions so i can use this too
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

I am taking this down by Sunday night because it is really not ready for production use yet. But since your problem is so urgent and you need this like yesterday, have at it. I make no warranties about its usability. It worked in local testing on PHP 5 on Apache 2.2 on Windows XP. Please do not ask for support as I am still making it work at the moment.
ziggy3000
Forum Contributor
Posts: 205
Joined: Fri Mar 23, 2007 3:04 pm

Post by ziggy3000 »

thanks everah it's awesome! :D
but if i want to use my highlight function, instead of the pear
so if i replace T_CONSTANTS.php and PHP_highlight.php with my func.php and replace some parts of parser-test.php needed to use my func, would it work?


I am taking this down by Sunday night because it is really not ready for production use yet.
do you have any idea when it will be?

Edited: Never Mind. I got it to work :D
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

I'm glad you got it. Keep in mind that I was toying with different things in it, like the links to the PHP functions and such. To disable/enable certain things you will need to edit the core code.
ziggy3000
Forum Contributor
Posts: 205
Joined: Fri Mar 23, 2007 3:04 pm

Post by ziggy3000 »

do you have a ten line or less code that replaces [b][/b] with <b></b>
the one in cbparser is kinda long, and i like to keep my code short

i added more buttons for url, image, and php code, but it doesn't parse the tags
it parses everything between the <?php and ?> tags in the textfield that you input

the only files i am using are parser-test.php and func.php(my highlight function) so i dont really have a core...
the test page was a little javascript and html and some php
func.php is a function named hc()
Post Reply