| View previous topic :: View next topic |
| Author |
Message |
pr0gr4mm3r Sub Minion of Pivot Groupie-Ness


Joined: 09 Nov 2006 Posts: 13
|
Posted: Fri Mar 09, 2007 4:34 pm Post subject: GeSHi to Publish Code in Pivot |
|
|
Extension Name: GeSHi for Pivot
Extension Author: pr0gr4mm3r
Download Location: Attached
Extension Description:
GeSHI for Pivot is a syntax highlighter based on GeSHi. This one is pretty straight forward, but there are two things you will have to do for this to work.
Setup:
- First, create a 'code' folder in your Pivot directory.
- Second, you are responsible for downloading the GeSHi classes and installing them on your site. You will have to include the main GeSHi class if you don't use PHP's __autoload() function.
Usage:
- Create the code and save them as text files in your code folder.
- Then call it like this: [[geshi:code.txt:php]] where 'code.txt' is the filename of the code file, and 'php' is the language of the code file.
If you want the snippet to have the option to have users download the code instructions can be found at the link below.
A sample of the snippet in action: [link]
Note: Please post all questions and discussions about this extension in this thread. Keeping the discussion confined to one thread will help others if they have any questions.
| Description: |
| GeSHi to Publish Code in Pivot |
|
 Download |
| Filename: |
snippet_geshi.php.zip |
| Filesize: |
1.18 KB |
| Downloaded: |
578 Time(s) |
|
|
| Back to top |
|
 |
Tenshi Platinum Sponsor


Joined: 12 Apr 2003 Posts: 1598 Location: Enschede, The Netherlands
|
|
| Back to top |
|
 |
idris Pivot Groupie In Training


Joined: 30 Mar 2009 Posts: 6
|
Posted: Sat Apr 04, 2009 2:18 am Post subject: Re: GeSHi to Publish Code in Pivot |
|
|
Just thought I'd add more detailed instructions as some things weren't obvious to me.
- Download geshi and extract it to somewhere on your web server - I put mine in /home/id/include/
- Download the snippet code, extract the source file and copy everything from it except the <php> and ?> tags to your clipboard.
- Paste that code into the file pivot/modules/module_snippets.php, at the end of the file but before the closing ?> tag.
- Add the line:
| Code: |
| include("/home/id/include/geshi/geshi.php"); |
to the top of the file, after the <?php tag. (Obviously substituting the correct path)
Create the dir pivot/code and put some files in it
Now, when you type e.g. [[geshi:file.php:php]] in an entry, it'll plonk in a code viewer panel.
Sorry if this is obvious but I've never installed a snippet thing before and I'm sure someone else will find this extra bit of detail useful.
Cheers,
Id
|
|
| Back to top |
|
 |
hansfn Pivot Team


Joined: 15 May 2004 Posts: 5289 Location: Molde, Norway
|
Posted: Sat Apr 04, 2009 4:57 am Post subject: Re: GeSHi to Publish Code in Pivot |
|
|
First of all you might want to consider trying the Codepress extension. Secondly, your instructions are very, very wrong. It's not that hard to add extensions to Pivot. The correct procedure is:
1) Download, then unzip snippet_geshi.php.zip and put snippet_geshi.php in your extensions/snippets/ directory.
2) Download Geshi and extract/unzip into the extensions directory.
If the Geshi snippet had been coded correctly, this would have been all that was needed. However, the lines
| Code: |
//Loading the Geshi class
require_once($Paths['extensions_path'].'geshi/geshi.php');
|
must be inserted before
| Code: |
| function snippet_geshi($code_loc, $code_lang) { |
NB! Never, ever edit the core files like modules/module_snippet.php.
_________________ My Pivot bookmarks, snippets and scripts| Pivot Documentation Project: Template tags |
|
| Back to top |
|
 |
| View previous topic :: View next topic |
|