1 of 2
1
Code Highlighter Extension
Posted: 03 January 2008 11:15 PM   [ Ignore ]  
Grad Student
Rank
Total Posts:  76
Joined  02-18-2007

Well I am finally getting around to zipping this up for everyone to test out.  It is getting there but I just haven’t had time to finish it all up.  I still have one proble to correct which is highlighting things like “is” inside of “list”.  Once I get that worked out it will be much better.

This is a beta version so as with all beta’s please provide feedback.

All highlighting is done through the use of stylesheets and a naming convention of your choice.  For instance, in my ignite_cpp.php file, I have that the class for strings will be called cpp_strings.  Then, in my stylesheet I have

.cpp_strings { color: green; }

which will highlight all strings green.  This is to prevent you from having to go into the php files to change something so simple.

If you have any questions please let me know and sorry about the small help file but time always gets the best of us.

File Attachments
http_docs.zip  (File Size: 40KB - Downloads: 120)
Profile
 
 
Posted: 04 January 2008 04:36 AM   [ Ignore ]   [ # 1 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  750
Joined  03-22-2004

Great will try it out for you!

Profile
 
 
Posted: 04 January 2008 09:26 AM   [ Ignore ]   [ # 2 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  750
Joined  03-22-2004

Jason,
I have installed the extension fine although I have a problem. Maybe I missed something.

In my entry I have

[ code lang="php" line_start="2"]
<?php
echo “test”;
?>
[
/code]

when rendered I receive

Notice: Undefined variable: code in /extensions/ext.ignite.php on line 155

and my rendered code has the background image aswell as the line numbers but no highlighting. My source looks like so with gobbled code

<div class='php' id='code'><span class='number'>2</span> 38897477e41c4be3c6<br /><span class='number'>3</span> 1869477e41c4bf3bc “test”;<br /><span class='number'>4</span> 22805477e41c4bebc4<br /></div>

Any help would be great thanks

Profile
 
 
Posted: 04 January 2008 10:49 AM   [ Ignore ]   [ # 3 ]  
Grad Student
Rank
Total Posts:  76
Joined  02-18-2007

Thanks for that.  Try this update.

Just changed the $code variable to $retCode.

File Attachments
http_docs.zip  (File Size: 40KB - Downloads: 103)
Profile
 
 
Posted: 04 January 2008 11:02 AM   [ Ignore ]   [ # 4 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  750
Joined  03-22-2004

Thanks, that has gotten rid of the error but the code is still being converted to something odd as above

Profile
 
 
Posted: 04 January 2008 11:20 AM   [ Ignore ]   [ # 5 ]  
Grad Student
Rank
Total Posts:  76
Joined  02-18-2007

Do you happen to have any other extensions or plugins that modify the content of your page?  That could be the problem, if so I will need to check that out.

In the mean time, try this version out.

File Attachments
http_docs.zip  (File Size: 40KB - Downloads: 94)
Profile
 
 
Posted: 04 January 2008 11:37 AM   [ Ignore ]   [ # 6 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  750
Joined  03-22-2004

I installed on a clean version of EE aswell and the same problem I’m afraid. The garbage is different everytime I refresh the page. The new version you supplied does not seem to help.

Other details ExpressionEngine 1.6.1 Build:  20071204

Can you post an example of how you add your code block to an entry? Maybe I am wrong there. I only put it together from looking at your extension file

Profile
 
 
Posted: 04 January 2008 11:43 AM   [ Ignore ]   [ # 7 ]  
Grad Student
Rank
Total Posts:  76
Joined  02-18-2007

You have it right.  I am running 1.6.0 so let me upgrade and see what is going on.  It could just be that I need to tweak something for the latest version.

That string of characters is the unique id for that part of the highlighting.  It is stored in an array and then transformed back to the highlighted code.  But for some reason your is not doing that.  That is why it is different each time you refresh thepage.

Profile
 
 
Posted: 04 January 2008 11:55 AM   [ Ignore ]   [ # 8 ]  
Grad Student
Rank
Total Posts:  76
Joined  02-18-2007

Just upgraded and no problems here.

What version of PHP are you running?

Profile
 
 
Posted: 04 January 2008 12:01 PM   [ Ignore ]   [ # 9 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  750
Joined  03-22-2004

Test Site 1 has 4.3.9 EngineHosting
Test Site 2 has 4.4.4 and is running in a windows environment using php running as a CGI

Both sites have same difficulty

Profile
 
 
Posted: 04 January 2008 01:38 PM   [ Ignore ]   [ # 10 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  637
Joined  07-02-2007

Did a quick test and got this:

Warning: preg_replace_callback() [function.preg-replace-callback]: Compilation failed: internal error: overran compiling workspace at offset 15832 in /home/rx/public_html/x/systeem/extensions/ext.ignite.php on line 122

Warning
: preg_replace_callback() [function.preg-replace-callback]: Compilation failed: internal error: overran compiling workspace at offset 15871 in /home/rx/public_html/x/systeem/extensions/ext.ignite.php on line 125

Made a new field with field type: none

[ code lang="php" line_start="2"]
<?php
echo “test”;
?>
[
/code]


Was the code i tried.

The error happens when i submit/update an existing entry and when i visit the template.

EE 1.6.1
PHP Version 5.2.2

I do have some extension installed.

 Signature 

Truly ExpressionEngine


Fielder Module ( Mass Custom Fields )
EntryData
reCAPTCHA Extension
Rewrite Module


See all my EE Addons

Profile
 
 
Posted: 04 January 2008 02:49 PM   [ Ignore ]   [ # 11 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  750
Joined  03-22-2004

Victor,
just make sure to remove the space after the ’[’ before the code . I had to add that so it would render correctly in these forums

Profile
 
 
Posted: 04 January 2008 02:50 PM   [ Ignore ]   [ # 12 ]  
Grad Student
Rank
Total Posts:  76
Joined  02-18-2007

Thanks for the update.  I will check into both of these.  The only problem I experienced was in a WAMP setup with PHP4 but it was due to a memory issue.  That was worked out but obviously something else is causing a problem.

Profile
 
 
Posted: 04 January 2008 04:00 PM   [ Ignore ]   [ # 13 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  637
Joined  07-02-2007
vinnyio - 04 January 2008 02:49 PM

Victor,
just make sure to remove the space after the ’[’ before the code . I had to add that so it would render correctly in these forums

I did that smile

 Signature 

Truly ExpressionEngine


Fielder Module ( Mass Custom Fields )
EntryData
reCAPTCHA Extension
Rewrite Module


See all my EE Addons

Profile
 
 
Posted: 04 January 2008 04:39 PM   [ Ignore ]   [ # 14 ]  
Grad Student
Rank
Total Posts:  76
Joined  02-18-2007

Not 100% sure if this will fix the problems but go ahead and try this version.  I am pretty sure that it has something to do with the way preg_replace_callback is calling other functions but until I am 100% positive I have to keep looking around.  smile

File Attachments
http_docs.zip  (File Size: 40KB - Downloads: 104)
Profile
 
 
Posted: 04 January 2008 05:49 PM   [ Ignore ]   [ # 15 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  750
Joined  03-22-2004

Sorry Jason but I am getting these errors now.

Notice: Undefined variable: this in /extensions/ext.ignite.php on line 193

Notice: Undefined property: code_matches in /extensions/ext.ignite.php on line 136

And you say the extension works on your installation of 1.6.0?

Profile
 
 
Posted: 04 January 2008 06:54 PM   [ Ignore ]   [ # 16 ]  
Grad Student
Rank
Total Posts:  76
Joined  02-18-2007

It works on 1.6.1 as well for me.  I figured that would happen because of the way the preg_replace_callback function is called.  I will keep looking and maybe see if I can at least duplicate the error.  It may be something within php.ini that is different.

Profile
 
 
Posted: 05 January 2008 02:45 PM   [ Ignore ]   [ # 17 ]  
Grad Student
Rank
Total Posts:  76
Joined  02-18-2007

Thanks to vinnyio for taking a look at the code he found a problem.  I forgot to add the & to $this which caused these errors.  I am also taking a look at the overall layout right now and are in the process of making some major updates.  Just things that I noticed after taking a deeper look into the actual code.

Once I get all this done I will post another build.  smile

Profile
 
 
Posted: 05 January 2008 04:43 PM   [ Ignore ]   [ # 18 ]  
Grad Student
Rank
Total Posts:  76
Joined  02-18-2007

Hey guys.  Do ya’ll like the way this groups multi-line items together?

http://www.codingdesigns.net/index.php

Not really sure if it should be like that or if people would rather see it line by line like before.

Profile
 
 
   
1 of 2
1
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 10:33 AM
Total Registered Members: 62444 Total Logged-in Users: 26
Total Topics: 76714 Total Anonymous Users: 20
Total Replies: 414463 Total Guests: 553
Total Posts: 491177    
Members ( View Memberlist )
Newest Members:  jirokatzenkerrilynnBrantbrettbuddinAndrew EllisKatsukeinikoaGreg Iwinskichartjes