CodeIgniter Forums
Displaying coding language in end user view - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Displaying coding language in end user view (/showthread.php?tid=28140)



Displaying coding language in end user view - El Forum - 03-02-2010

[eluser]elaniobro[/eluser]
I have been reading through the forums and the wiki, I have not seen any instance or refrence to what I am trying to accomplish, perhaps it is due to a lack of vocab on the subject.

I would like to do what this forum does. Essential use[code[]/code] (I reversed them so you can see) to display Code on the webpage. Is their a helper/library out there that can achieve this?

So in essense I would like to be able to display code on my site similar to how you see it below:
Code:
$this->load->view('header', $data);
            $this->load->view('campaign');
            $this->load->view('thoughts_view', $data);
            $this->load->view('footer');

It would be even better if you can get Line numbers involved.


Displaying coding language in end user view - El Forum - 03-02-2010

[eluser]John_Betong[/eluser]
Play around with this and see if it help:
Code:
<?php highlight_file( __FILE__ ); ?>
 
 
 


Displaying coding language in end user view - El Forum - 03-02-2010

[eluser]elaniobro[/eluser]
Thanks, could you point me to the documentation for that so I can read up on it?

Appreciate the help Smile


Displaying coding language in end user view - El Forum - 03-02-2010

[eluser]John_Betong[/eluser]
[quote author="elaniobro" date="1267601772"]Thanks, could you point me to the documentation for that so I can read up on it?

Appreciate the help Smile[/quote]

A quick Google and...

http://php.net/manual/en/function.highlight-file.php

I also discovered show_source(...) but have not tried it.

And an example:

http://johns-jokes.com/downloads/codeigniter/css_tables/