HTML Logo by World Wide Web Consortium (www.w3.org). Click to learn more about our commitment to accessibility and standards.

Moving forward with Composr

ocPortal has been relaunched as Composr CMS, which is now in beta. ocPortal 9 will be superseded by Composr 10.

Head over to compo.sr for our new site, and to our migration roadmap. Existing ocPortal member accounts have been mirrored.


Installing Geshi

Login / Search

 [ Join | More ]
 Add topic 
Posted
Rating:
#107983 (In Topic #21054)

Non-joined user

Proper way to install Geshi source code highlighter

I installed Geshi from inside of the addons in ocPortal.

It is not working. I tried a basic html page below, but its not being highlighted.

Code

<!DOCTYPE html>
<html>
<body>

<h1>My First Heading</h1>

<p>My first paragraph.</p>

</body>
</html>
Back to the top
 
Posted
Rating:
#107984
Avatar

Community saint

GeSHi applies syntax highlighting to a block of coding which is pasted inside the Comcode 'code' tag as follows:

Code

[codebox="<language>"]<the code goes here>[/codebox]
Back to the top
 
Posted
Rating:
#107985

Non-joined user

I did and it still don't work. I read that I have to actually download Geshi and install it? Is this true?

This is what I did:



And this is the result:

Back to the top
 
Posted
Rating:
#107987
Avatar

Community saint

I haven't used the addon personally, but if you read that somewhere on this site then it is likely to be correct. Perhaps it couldn't be bundled into the addon for some reason.
Back to the top
 
Posted
Rating:
#107988
Avatar

Community saint

Ahh yes, it does say that…
ocPortal supports syntax highlighting via GeSHi. This operates using the normal 'code' and 'codebox' tags, adding support for GeSHi highlighter codes to the 'param' attribute of the tags. For this support to function it is necessary for you to download GeSHi and extract the geshi.php file and geshi directory into ocPortal's sources_custom directory. This is for licensing reasons.
Back to the top
 
Posted
Rating:
#107989
Avatar

Community saint

That actually reads as if ocPortal natively supports GeSHi without the addon, which from your screenshots it doesn't. The actual addon page doesn't mention the need to download GeSHi. Hopefully Chris will update the info in both places.

There seems to be a few versions floating around, but I believe this is the official GeSHi website
Back to the top
 
Posted
Rating:
#107994
Avatar

We do support it without the addon. The addon just pulls the code in there equivalently to pulling it in manually.

Don't use angular brackets around the language name.

Code

[code="HTML"]
<!DOCTYPE html>
<html>
<body>

<h1>My First Heading</h1>

<p>My first paragraph.</p>

</body>
</html>
[/code]

Also turn off WYSIWYG, as it will badly mangle it.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#107995
Avatar

I can see why you tried to use angular brackets due to the way the addon help was written, but we didn't mean to literally include those :).


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#108002

Non-joined user

This is not working.

Code

[codebox="html"]<!DOCTYPE html>
<html>
<body>

<h1>My First Heading</h1>

<p>My first paragraph.</p>

</body>
</html>[/codebox]​


I checked to see if:

sources_custom/geshi.php – This file is a script file
sources_custom/geshi/4cs.php – This file is a script file
sources_custom/geshi/abap.php – This file is a script file
sources_custom/geshi/actionscript.php – This file is a script file
sources_custom/geshi/actionscript3.php – This file is a script file

etc........  was in created and if all files were in place? They are there.

Do I need to do an PHP include or PHP Require inside a php file some were?

ThX
Back to the top
 
Posted
Item has a rating of 5 (Liked by KingBast)  
Rating:
#108003

Non-joined user

Chris your syntax worked:

[code="HTML"]CODE GOES HERE[/code]

This syntax however does not work:

[codebox="html"]CODE GOES HERE[/codebox]

Remove the word box from codebox. :)

Maybe with the updated version of Geshi, I"m not for sure it may work with "codebox"?
Back to the top
 
Posted
Item has a rating of 5 (Liked by KingBast)  
Rating:
#108005

Non-joined user

One question. Why isn't there a "Geshi" code box added that uses the proper syntax for syntax highlighting when Geshi is imported and installed into ocPortal?

I'm not really lazy but it would be nice to have that one extra little Geshi button, because it would speed things along.
Back to the top
 
Posted
Rating:
#108065
Avatar

Guest said

Chris your syntax worked:

[code="HTML"]CODE GOES HERE[/code]

This syntax however does not work:

[codebox="html"]CODE GOES HERE[/codebox]
Remove the word box from codebox. :)

Maybe with the updated version of Geshi, I"m not for sure it may work with "codebox"?


Both should work, and I just tested to confirm. They actually are handled within the same code ('codebox' is actually just a shorthand for a code tag set to have scrolling).
If you are using WYSIWYG it can be easy to accidentally get HTML formatting on the tags and corrupt things. It's best to turn it off when dealing with code tags.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#108066
Avatar

vynun said

One question. Why isn't there a "Geshi" code box added that uses the proper syntax for syntax highlighting when Geshi is imported and installed into ocPortal?

I'm not really lazy but it would be nice to have that one extra little Geshi button, because it would speed things along.


For the next patch release we'll add the 'code' tag into the Comcode Tag assistant, as it should be there (it was hidden if WYSIWYG was on, which is basically a bug).

I've added a tracker issue to improve the 'code' tags handling within the Comcode Tag assistant:
0001935: Improve GeSHi Comcode Tag Assistant support - ocPortal feature tracker

I'm "against" us getting into the game of adding new direct buttons to the main Comcode/WYSIWYG editor. It would be an endless exercise, everyone would want their own set of buttons, and we'd end up having to make icons for all of them and have a big complex UI to configure which are and are not shown, weeks of work there. (I wouldn't want us to be inconsistent, and only support one or two – we should do everything in a clean consistent way)
If webmasters want particular buttons adding it can be done on an individual basis via template edits.
If anyone wants to sponsor us doing it right, I'd then be "for" it (I agree it would be cool functionality), but I honestly think it's very unlikely anyone would given the very high cost:
0001936: Full toolbar management for Comcode. - ocPortal feature tracker



Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#108067
Avatar

Actually I contradict myself because there is a code button right now, and we did decide a long time ago what the most basic buttons should be.

However, I think that doesn't really invalidate what I said, as the distinction still remains between us having some very simple/basic buttons, and us having a wider set of buttons for accessing the full Comcode functionality :).

The existing code button doesn't ask what language because it's intentionally very simple. If we did extend the icon set, we'd probably want to have two available code buttons: a simple one, and one with full configurability.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
1 guests and 0 members have just viewed this: None
Control functions:
 Add topic 

Quick reply   Contract

Your name:
Your message: