showing code |
[eluser]St0neyx[/eluser]
Hi all, I'm making an Code Igniter help site for my work, i'm the first who's working/testing codeigniter and want to make some code examples and stuff.. (also makes me more experienced with CI) now is my question.. how do i print out code like this (and i mean what you see the php code with colors and all) Code: <?php echo 'example code'; ?>
[eluser]batteries[/eluser]
have you checked the manual? it should have something in there.
[eluser]gunter[/eluser]
yes, I think there was something... maybe try: highlight_string(String); highlight_file (File); ahhh! search in the user_guide for: highlight_code()
[eluser]batteries[/eluser]
i was trying to teach a man how to fish.. and you ruined it by giving it to him
[eluser]esra[/eluser]
You might also look as the Geshi library. (Do a web search).
[eluser]St0neyx[/eluser]
[quote author="batteries" date="1185242797"]have you checked the manual? it should have something in there.[/quote] [quote author="batteries" date="1185244941"]i was trying to teach a man how to fish.. and you ruined it by giving it to him [/quote] I did look at the forums and userguide.. ;-) I always do that, but could'n find it.. thats why i posted it..
[eluser]St0neyx[/eluser]
[quote author="gunter" date="1185244684"]yes, I think there was something... maybe try: highlight_string(String); highlight_file (File); ahhh! search in the user_guide for: highlight_code()[/quote] Thx i will look at it Edit: Hmm it works half.. if i do this Code: $string = and if i print out the code this is the result function index() { // definde the page array Array = array(); Array = array(); // define the header content and footer // load the page Object id #10->view('index', Array); } you can see my page and data arrays are different and the this->load->view is different
[eluser]pr0digy[/eluser]
You can also use JavaScript for this. Here is a nice little library - code prettify. I use it on my site.
[eluser]glemigh[/eluser]
I found this somewhere, and hacked it up for my needs, maybe you can get some ideas from it. source.php Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
[eluser]glemigh[/eluser]
and the css, source.css is to big to paste into a message, so I tar'ed up both and you can grab it here: source_show.tgz Hope it helps you in some way torwards your goal. George |
Welcome Guest, Not a member yet? Register Sign In |