Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Include a [code] Button with highlighting for python?
#1
Hi,

I am trying to include some sourcecode in one of my blog entries. I do not want this code to be executed but to be shown as Code.
I tried different tags but nothign seems to work.
Do I need a special plugin?
With best regards

p91
Reply
#2
p91 Wrote:Hi,

I am trying to include some sourcecode in one of my blog entries. I do not want this code to be executed but to be shown as Code.
I tried different tags but nothign seems to work.
Do I need a special plugin?
With best regards

p91

What happens if you encode the code into entities or into decimal chars ?
Addons: blue business theme, Online Visitors, Notepad
Reply
#3
Sorry to say but I am a total noob with getsimple so I have no idea what entities are.
Using google also only turned up many results of the form: "Entities do not work, what do i do wrong?"
What I tries is the usual code blocks ([ 554code] <code> etc) which I found in the wiki (see the dokuwiki) and I tried to find more information about this problem with google but googling "code getsimple" or the like just turns up problems about coding in getsimple and not about putting source code into a blog entry.
Reply
#4
Its called "formatted" in styles which will wrap it in a pre, i guess it mean preformatted, its a rather dumb label.
You wont see any change in the editor itself, only on your page.

If you want syntax highlighting for python youll need a code highligting script.

You can also use style "computer code" but that only does snippets or single lines.
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#5
please read the wiki.
There is information how to use and extend the editor.
There is an article how to include the code-highlighting-script into the editor and how to extend thus the functionality of the script

I do not know why I spend so much time describing solutions etc. if it is completely ignored ;=)

and here is the link for the lazy ones: http://get-simple.info/wiki/how_to:edito...xhighlight ;=)
|--

Das deutschsprachige GetSimple-(Unter-)Forum:   http://get-simple.info/forums/forumdisplay.php?fid=18
Reply
#6
Hi,

I had already seen this and tried it out.
Unfortunately, the Code button will not turn up in the editor, even if you set a custom toolbar with 'Code' in it.
Reply
#7
p91 Wrote:Unfortunately, the Code button will not turn up in the editor, even if you set a custom toolbar with 'Code' in it.
sorry, you must have done something wrong, see here: bottom row at the right:
[Image: codebutton.jpg]

this is a screenshot from www.get-simple.de
|--

Das deutschsprachige GetSimple-(Unter-)Forum:   http://get-simple.info/forums/forumdisplay.php?fid=18
Reply
#8
I finally got it to work.
For some reason using the settings in the ckeditor.js did not work but after using
define('GSEDITOROPTIONS', "
extraPlugins : 'syntaxhighlight',
syntaxhighlighthLangDefault : 'php'
");

in the gsconfig.php the button turned up

[EDIT]
While I now have a Code button and can add code it still does not look formated nor does it have numbering in front so my guess is that my header is still incorrect.

But I have added the
<!-- SyntaxHighlighter -->
...
stuff to my header.inc.php.
I also added the script for Cpp and Python as these two are the ones I need the most.


[EDIT2]
After adding
<script type="text/javascript">SyntaxHighlighter.all();</script>
to my header it is now working!
Reply
#9
sometimes it takes time and patience to succeed at last!
Not only for the users, but also for the moderators ;=)

I was sure it would work

Cheers, Connie
|--

Das deutschsprachige GetSimple-(Unter-)Forum:   http://get-simple.info/forums/forumdisplay.php?fid=18
Reply
#10
Forget a bunch of that noise, I'll write a plugin to do it I think
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#11
Shawn,

this is already done with an CKEDITOR-Plugin, and it is described exactly in the wiki

do you really think a Plugin will help? It is not said that everybody has so much problems, I know of a lot of smooth integrations, following the WIKI-instructions
|--

Das deutschsprachige GetSimple-(Unter-)Forum:   http://get-simple.info/forums/forumdisplay.php?fid=18
Reply
#12
@Connie

Leaving asside the ckeditor.js stuff not working, the wiki is still missing the information on <script type="text/javascript">SyntaxHighlighter.all();</script> and without this line it will not work.
The line is mentioned here http://alexgorbatchev.com/SyntaxHighligh...ation.html but not in the wiki so maybe it was not needed in an older version?
Reply
#13
p91,

this is what is included in the template.php of the get-simple.de-site:
Code:
<!-- SyntaxHighlighter -->
<link type="text/css" rel="stylesheet" href="http://www.get-simple.de/admin/template/js/syntaxhighlighter/styles/shCore.css"/>
<link type="text/css" rel="stylesheet" href="http://www.get-simple.de/admin/template/js/syntaxhighlighter/styles/shThemeDefault.css"/>
<script type="text/javascript" src="http://www.get-simple.de/admin/template/js/syntaxhighlighter/scripts/shCore.js"></script>
<script type="text/javascript" src="http://www.get-simple.de/admin/template/js/syntaxhighlighter/scripts/shBrushCss.js"></script>
<script type="text/javascript" src="http://www.get-simple.de/admin/template/js/syntaxhighlighter/scripts/shBrushJScript.js"></script>
<script type="text/javascript" src="http://www.get-simple.de/admin/template/js/syntaxhighlighter/scripts/shBrushPhp.js"></script>
<script type="text/javascript" src="http://www.get-simple.de/admin/template/js/syntaxhighlighter/scripts/shBrushPlain.js"></script>

and it is working without that extra-script-tag

I checked, and we use the most actual versions of both scripts (highlighter-script and CKeditor-plugin)

there are 2 different ways to "install" the script, and we use the second way to install it,
Code:
<script type="text/javascript">
     SyntaxHighlighter.all()
</script>
belongs to the other method which is not used in "our" integration, so I think you have some kind of mismatch in your site .... (see here: http://alexgorbatchev.com/SyntaxHighligh...tion.html)

so again: I still can't find why the integration did not work at your place.
And I still do not see any mistake or missing information "on my side" ;=)

As you do not tell us the URL of your site, I cannot check how you integrated the script and I am not a soothsayer ;=(

as I can't control how you integrated the script and if you followed all necessary steps strictly, I will add your info as "just in case-" info in the WIKI, ok?


PS: all registered users here are registered in the WIKI, too
"don't ask what your country can do for you, ask what you can do for your country" and complete the WIKI when you miss some information ;=)
Nevermind, I will do it
|--

Das deutschsprachige GetSimple-(Unter-)Forum:   http://get-simple.info/forums/forumdisplay.php?fid=18
Reply
#14
@Connie

Sorry if I was rude, I am just a bit confused and frustrated by it.
Thanks for adding the information to the wiki, I did not know I could edit it as well.
The page I am working on can be found under flambda.de (all work in progress so please do not expect to much).

With best regards

p91
Reply
#15
p91,

no you were not rude, both we were frustrated that it would not work
by the way: as you have a german URL, we could have communicated in the german sub-forum as well!

Keep up with questions or give us tips and hints,

cheers, Connie
|--

Das deutschsprachige GetSimple-(Unter-)Forum:   http://get-simple.info/forums/forumdisplay.php?fid=18
Reply
#16
I tried this and I can't get it working at all.
I can see the plugin.js being fetched, but I never get a button.

Very strange.

What version GS you guys on ?

EDIT:
I only got it working by adding 'Code' to my buttons manually.
I assumed that
"After all, you will see a new icon in your toolbar: "
meant is was automatic.

You can't really blame people when the documentation (wiki) isn't complete.
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#17
shawn_a Wrote:"After all, you will see a new icon in your toolbar: "
meant is was automatic.

You can't really blame people when the documentation (wiki) isn't complete.

sorry, but I was sure that the entry in gsconfig.php was there in the wiki, in the 'GSEDITORTOOL'-section

sure it is obvious that the icon has to be defined in the gsconfig.php as will

I will add that to the wiki tomorrow, I apologize
|--

Das deutschsprachige GetSimple-(Unter-)Forum:   http://get-simple.info/forums/forumdisplay.php?fid=18
Reply




Users browsing this thread: 1 Guest(s)