The my-hacks.php file needs to conform to some requirements. The
My Hacks Wiki Page should help you.
within the my-hacks.php file, did you include the wp-grins.php file??
TG
I’ve got “my-hacks” enabled, and I uploaded it into my blog root directory. I uploaded just the file without the wp-grins code and that gives me no errors, so I know there was no whitespace where there shouldn’t be whitespace. It’s when I include the code for wp-grins is when I get the error.
I copied and pasted the code and I also tried it with typing the code exactly as it was written in the readme file, but I’m still getting this error.
My husband just asked me if maybe this hack wasn’t compatible with the version I’m running. I’m running 1.02.
It is compatible .. I also use it with 1.2a
This is the code you are running ?
<?php
// WP Grins
// version 1.0, 2004-01-24
//
// Copyright (c) 2004 Alex King
// http://www.alexking.org/software/wordpress/
//
// This is an add-on for WordPress
// http://wordpress.org/
//
// **********************************************************************
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// *****************************************************************
function wp_grins() {
global $wpsmiliestrans;
$smilies_directory = get_settings('smilies_directory');
$grins = '';
$smiled = array();
foreach ($wpsmiliestrans as $tag => $grin) {
if (!in_array($grin, $smiled)) {
$smiled[] = $grin;
$tag = str_replace(' ', '', $tag);
$grins .= '<img src="'.$smilies_directory.'/'.$grin.'" alt="'.$tag.'" onclick="grin(\''.$tag.'\');"/> ';
}
}
print('<div id="wp_grins">'.$grins.'</div>');
ob_start();
?>
<script type="text/javascript">
function grin(tag) {
var myField;
if (document.getElementById('content') && document.getElementById('content').type == 'textarea') {
myField = document.getElementById('content');
}
else if (document.getElementById('comment') && document.getElementById('comment').type == 'textarea') {
myField = document.getElementById('comment');
}
else {
return false;
}
if (document.selection) {
myField.focus();
sel = document.selection.createRange();
sel.text = tag;
myField.focus();
}
else if (myField.selectionStart || myField.selectionStart == '0') {
var startPos = myField.selectionStart;
var endPos = myField.selectionEnd;
var cursorPos = endPos;
myField.value = myField.value.substring(0, startPos)
+ tag
+ myField.value.substring(endPos, myField.value.length);
cursorPos += tag.length;
myField.focus();
myField.selectionStart = cursorPos;
myField.selectionEnd = cursorPos;
}
else {
myField.value += tag;
myField.focus();
}
}
</script>
<?php
$grins = ob_get_contents();
ob_end_clean();
print($grins);
}
?>
Sorry, I haven’t gotten back to this. I was sick last week.
Anyway, yes, that’s the code from the wp-grins.php file. I did notice that after I downloaded it, all the code went for two lines and there were those boxes that Notepad sticks into a file to represent whenver someone hit “return”. So I got rid of those and made everything be on the lines they were supposed to be. That didn’t work. I’m still getting the
Parse error: parse error in /home/assorte/public_html/blog/my-hacks.php on line 2 message.
I only get this when I put the code you have to put into the ‘my-hacks’ file. I copied and pasted it and this is the code I’m supposed to put there.
<?php require_once('wp-grins.php'); ?>
This is what’s on line 2.
I’m working off the assumption that ‘wp-grins.php’ is supposed to be uploaded into the root directory, because I don’t remember seeing anything written as to where this file should go. I uploaded it and ‘my-hacks’ into my blog’s root directory.
Anonymous
I’m getting that error as well.
Parse error: parse error in /home/staticdr/public_html/wordpress/my-hacks.php on line 2
I have my-hacks.php and wp-grins.php uploaded to my root directory. Could it be that since I have my blog homepage address different than the directory I installed WordPress too it is effecting it?
Example: Root directory is: http://www.staticdream.com/wordpress but I have my index.php file pointing towards http://www.staticdream.com