Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Editor highlight PHP syntax
Old 02-28-2009, 01:09 AM Editor highlight PHP syntax
Average Talker

Posts: 17
Name: Philips Tel
Trades: 0
hello everybody,

I am a beginner in php
I have some questions about how to highlight the php syntax to the browser, I have tried by using the highlight_file($file) and highlight_source($file), but it just requires us to save the file that we want to display, so what if I want the php code just stored in the database and display it to the browser without having to save the file.


You can see the example by visiting this url:

http://www.talkphp.com/advanced-php-...ion-class.html

the answer will be very appreciated.

Last edited by philips; 02-28-2009 at 10:39 PM..
philips is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 02-28-2009, 05:26 AM Re: Editor highlight PHP syntax
EdB
Skilled Talker

Posts: 79
Name: Ed Barnett
Trades: 0
Sorry I don't quite follow what the question is...?
EdB is offline
Reply With Quote
View Public Profile Visit EdB's homepage!
 
Old 02-28-2009, 05:31 AM Re: Editor highlight PHP syntax
Jaryth000's Avatar
Skilled Talker

Posts: 59
Name: Jaryth
Location: Canada
Trades: 0
So wait...
You want an Editor that can highlight PHP Syntax that your working on? (I use PSPad)
Or
You want to create code, that will automatically highlight posted PHP script (like in that example you linked to)?
__________________

Please login or register to view this content. Registration is FREE
My personal website
-Jaryth (UID590)
Jaryth000 is offline
Reply With Quote
View Public Profile Visit Jaryth000's homepage!
 
Old 02-28-2009, 06:28 AM Re: Editor highlight PHP syntax
lizciz's Avatar
Super Spam Talker

Posts: 807
Name: Mattias Nordahl
Location: Sweden
Trades: 0
Perhaps something like this?
http://se.php.net/manual/en/function...ght-string.php
lizciz is offline
Reply With Quote
View Public Profile Visit lizciz's homepage!
 
Old 02-28-2009, 11:04 PM Re: Editor highlight PHP syntax
Average Talker

Posts: 17
Name: Philips Tel
Trades: 0
right, that i mean.....

but, anybody know how the webmaster of this site :
http://www.talkphp.com/advanced-php-...ion-class.html
highlight its php syntax and display it into the textarea??????
philips is offline
Reply With Quote
View Public Profile
 
Old 03-01-2009, 03:56 PM Re: Editor highlight PHP syntax
Average Talker

Posts: 21
Name: Hal
Trades: 0
I think what you want is this:

For PHP code, enclose your code in [php ] and [/php ] tags (minus the spaces).

Check out the "Sticky" at the top of the PHP forum.
hoco is offline
Reply With Quote
View Public Profile
 
Old 03-01-2009, 04:55 PM Re: Editor highlight PHP syntax
rogem002's Avatar
PHP Chap

Posts: 843
Name: Mike
Location: United Kingdom
Trades: 0
The actual code behind that basically is:
PHP Code:
<?php
$highlighted_code 
'<pre><code>'.highlight_string  ('<?php /* code here */ ?>');.'</code></pre>'

echo $highlighted_code;
?>
The pre and the code tag are formatted by CSS to look like funky boxes. It also uses the BB code stuff in PHP to make anything [php] highlighted.
__________________
My Blog/Site:
Please login or register to view this content. Registration is FREE
rogem002 is offline
Reply With Quote
View Public Profile Visit rogem002's homepage!
 
Old 03-01-2009, 06:23 PM Re: Editor highlight PHP syntax
Decaf's Avatar
Ultra Talker

Posts: 489
Name: Adam
Trades: 0
Ex:
HTML Code:
<code style="white-space:nowrap">
<!-- php buffer start -->
            <code>
                        <span style="color: #000000">
                        <span style="color: #0000BB">Add_Talkupation</span>
                        <span style="color: #007700">(</span>
                        <span style="color: #DD0000">'rogem002'</span>
                        <span style="color: #007700">);&nbsp;</span>
                        <span style="color:#FF8000">//&nbsp;Because&nbsp;sharing&nbsp;is&nbsp;awesome!&nbsp;<br /></span>
                        <span style="color: #0000BB"></span>
                        </span>
            </code>
<!-- php buffer end -->
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE

Decaf is offline
Reply With Quote
View Public Profile Visit Decaf's homepage!
 
Old 03-02-2009, 12:18 AM Re: Editor highlight PHP syntax
lizciz's Avatar
Super Spam Talker

Posts: 807
Name: Mattias Nordahl
Location: Sweden
Trades: 0
Wait... Was your question how to write php code on this forum (like the above suggestions) or how do accomplish that on your own site? I thought it was for your site.

If so, to get it into a textarea:

PHP Code:
<textarea>
  <?php
highlight_string
($you_string);
?>
     </textarea>
lizciz is offline
Reply With Quote
View Public Profile Visit lizciz's homepage!
 
Old 03-02-2009, 01:16 AM Re: Editor highlight PHP syntax
Average Talker

Posts: 17
Name: Philips Tel
Trades: 0
ok, now i have understand and get what i want for my php highlighting..

thanks very much for all the help......

philips is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Editor highlight PHP syntax
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.62737 seconds with 12 queries