Simple Machines Community Forum

General Community => Scripting Help => Aiheen aloitti: e_har - tammikuu 09, 2007, 02:01:46 AP

Otsikko: How to integrate GeSHiSmf with other themes?
Kirjoitti: e_har - tammikuu 09, 2007, 02:01:46 AP
Hi does anyone knows how to integrate GeSHiSmf with "orange-lt05" theme?

I've got no problems with the default and classic themes.....
I've always failed on the Post.template.php.

Just that i am not sure what to change...
Any help would be greatly appreciated. Thanks in Advance...

Otsikko: Re: How to integrate GeSHiSmf with other themes?
Kirjoitti: Daniel15 - tammikuu 10, 2007, 12:29:17 AP
Hello, and welcome to the forums! :D
The easiest way to do this is to upload the package to my package parser (see the link in my signature). Choose the Show theme edits option, and it will tell what you need to edit.
Otsikko: Re: How to integrate GeSHiSmf with other themes?
Kirjoitti: e_har - tammikuu 10, 2007, 01:36:36 AP
Thanks for the welcome.

But sorry dude, i've got this error when i use ur script...

Fatal error: Uncaught exception 'Exception' with message 'String could not be parsed as XML' in /var/www/smf/package.php:73 Stack trace:
#0 /var/www/smf/package.php(73): SimpleXMLElement->__construct('')
#1 /var/www/smf/package.php(49): parsePackageInfoXML('/tmp/smf_xml/pa...', 'install', 'all')
#2 /var/www/smf/package.php(631): parseArchive('/tmp/php6krXf1', 'install', 'all')
#3 {main} thrown in /var/www/smf/package.php on line 73
Otsikko: Re: How to integrate GeSHiSmf with other themes?
Kirjoitti: Daniel15 - tammikuu 10, 2007, 02:28:50 AP
It seems to be a problem with how the mod is archived (it's inside a folder)...
So, I'll post the steps here for you:
In Themes/[theme name]/style.css, find:

/* The main post box - this makes it as wide as possible. */

Add before:

.geshi {
color: #000000;
background-color: #ccceec;
font-family: monospace;
font-size: 1.2em;
border: 1px solid #000000;
margin: 1px auto 1px auto;
padding: 1px;
width: 99%;
overflow: auto;
white-space: pre;
max-height: 24em;
}


Themes/[theme name]/Post.template.php, find:

foreach ($context['bbc_tags'][0] as $image => $tag)
{
// Is there a "before" part for this bbc button? If not, it can't be a button!!
if (isset($tag['before']))
{
// Is this tag disabled?
if (!empty($context['disabled_tags'][$tag['code']]))
continue;

$found_button = true;

// If there's no after, we're just replacing the entire selection in the post box.
if (!isset($tag['after']))
echo '<a href="javascript:void(0);" onclick="replaceText(\'', $tag['before'], '\', document.forms.', $context['post_form'], '.', $context['post_box_name'], '); return false;">';
// On the other hand, if there is one we are surrounding the selection ;).
else
echo '<a href="javascript:void(0);" onclick="surroundText(\'', $tag['before'], '\', \'', $tag['after'], '\', document.forms.', $context['post_form'], '.', $context['post_box_name'], '); return false;">';

// Okay... we have the link. Now for the image and the closing </a>!
echo '<img onmouseover="bbc_highlight(this, true);" onmouseout="if (window.bbc_highlight) bbc_highlight(this, false);" src="', $settings['images_url'], '/bbc/', $image, '.gif" align="bottom" width="23" height="22" alt="', $tag['description'], '" title="', $tag['description'], '" style="background-image: url(', $settings['images_url'], '/bbc/bbc_bg.gif); margin: 1px 2px 1px 1px;" /></a>';
}
// I guess it's a divider...
elseif ($found_button)
{
echo '<img src="', $settings['images_url'], '/bbc/divider.gif" alt="|" style="margin: 0 3px 0 3px;" />';
$found_button = false;
}
}


Add after:

// Print a drop down list for all the GeSHi-languages we "allow"!
if (!isset($context['disabled_tags']['color']))
echo ' <select onchange="surroundText(\'[code=\' + this.options[this.selectedIndex].value.toLowerCase() + \']\', \'[ /code]\', document.forms.', $context['post_form'], '.', $context['post_box_name'], '); this.selectedIndex = 0; document.forms.', $context['post_form'], '.', $context['post_box_name'], '.focus(document.forms.', $context['post_form'], '.', $context['post_box_name'], '.caretPos);" style="margin-bottom: 1ex;">
<option value="" selected="selected">GeSHi</option>
<option value="actionscript-french"> Actionscript-French </option>
<option value="actionscript"> Actionscript </option>
<option value="ada"> Ada </option>
<option value="apache"> Apache Log </option>
<option value="applescript"> AppleScript </option>
<option value="asm"> ASM </option>
<option value="asp"> ASP </option>
<option value="bash"> Bash </option>
<option value="caddcl"> CAD DCL </option>
<option value="cadlisp"> CADLisp </option>
<option value="c_mac"> C for Macs </option>
<option value="c"> C </option>
<option value="cpp"> C++ </option>
<option value="csharp"> C# </option>
<option value="css"> CSS </option>
<option value="delphi"> Delphi </option>
<option value="diff"> Diff </option>
<option value="div"> DIV </option>
<option value="dos"> DOS </option>
<option value="d"> D </option>
<option value="eiffel"> Eiffel </option>
<option value="freebasic"> FreeBasic </option>
<option value="gml"> GML </option>
<option value="html4strict"> HTML4 Strict </option>
<option value="ini"> INI </option>
<option value="inno"> Inno </option>
<option value="java"> Java </option>
<option value="javascript"> Javascript </option>
<option value="lisp"> Lisp </option>
<option value="lua"> Lua </option>
<option value="matlab"> Matlab </option>
<option value="mpasm"> Microprocessor ASM </option>
<option value="nsis"> MSIS </option>
<option value="objc"> Objective C </option>
<option value="ocaml-brief"> OCaml-Brief </option>
<option value="ocaml"> OCaml </option>
<option value="oobas"> OpenOffice Basic </option>
<option value="oracle8"> Oracle 8 SQL </option>
<option value="pascal"> Pascal </option>
<option value="perl"> Perl </option>
<option value="php-brief"> PHP-Brief </option>
<option value="php"> PHP </option>
<option value="python"> Python </option>
<option value="qbasic"> Q(uick)BASIC </option>
<option value="ruby"> Ruby </option>
<option value="scheme"> Scheme </option>
<option value="sdlbasic"> SDLBasic </option>
<option value="smarty"> Smarty </option>
<option value="sql"> SQL </option>
<option value="vbnet"> Visual BASIC .NET </option>
<option value="vb"> Visual BASIC </option>
<option value="vhdl"> VHDL </option>
<option value="visualfoxpro"> Visual Fox Pro </option>
<option value="xml"> XML </option>
</select>';

Note: Replace [ /code] with [/code] in the above code
Otsikko: Re: How to integrate GeSHiSmf with other themes?
Kirjoitti: e_har - tammikuu 10, 2007, 02:42:55 AP
Thanks dude...but don't i need to add something in the install.xml???
<file name="$boarddir/Themes/[theme name]/style.css">
...

So sorry for asking so much questions... ;D
Otsikko: Re: How to integrate GeSHiSmf with other themes?
Kirjoitti: Daniel15 - tammikuu 10, 2007, 04:02:29 AP
You don't need to add it to the install.xml. After installing the mod, you edit the files for your theme manually.
Note that if your theme doesn't have a Post.template.php file, you don't need to do anything ;)
Otsikko: Re: How to integrate GeSHiSmf with other themes?
Kirjoitti: e_har - tammikuu 10, 2007, 04:53:05 AP
Oh silly me...i modified the files then installed the MODs...will there be any problem???
Otsikko: Re: How to integrate GeSHiSmf with other themes?
Kirjoitti: Daniel15 - tammikuu 10, 2007, 05:42:23 AP
Seeing as it's a custom theme, there shouldn't be any problems (mods don't usually touch any themes).
Check your theme (more specifically, the New Topic or reply page), and see if it works :)
Otsikko: Re: How to integrate GeSHiSmf with other themes?
Kirjoitti: e_har - tammikuu 11, 2007, 02:14:54 AP
Sorry, after i did exactly what you did...i have this error

Fatal error: Cannot instantiate non-existent class: geshi in <myserver>/community/Sources/Subs.php(1181) : runtime-created function on line 15
Otsikko: Re: How to integrate GeSHiSmf with other themes?
Kirjoitti: Daniel15 - tammikuu 11, 2007, 05:30:43 AP
LainaaSorry, after i did exactly what you did...i have this error
It seems like some people are having this problem... The solution is to make sure the geshi directory was extracted correctly. In your Sources directory, there should be a geshi directory. In this directory, there should be a 'geshi.php' file, and a geshi directory (ie. Sources/geshi/geshi). If these don't exist, reupload them (from the archive).
Otsikko: Re: How to integrate GeSHiSmf with other themes?
Kirjoitti: e_har - tammikuu 11, 2007, 07:50:03 AP
Thanks a lot Daniel15. You're absolutely spot on. It's exactly what you said.