Posts Tagged ‘wordpress’

Syntax Highlighter, WordPress & CSS

// April 26th, 2009 // Comments Off on Syntax Highlighter, WordPress & CSS // Tools, wordpress

I recently changed my Syntax Highlighter (which was cool, but old and abandon-ware) for the SyntaxHighlighter Evolved. Which I must say I love. Old versions were really bad. They were not that flexible. But version 2.0 is VERY flexible, and looks great. So I did the change in Neonlabs and Structum.

I stumbled with several problems. The first, and the one that bothered me more, was that in the Structum page, the code seemed to be broken into weird lines.

Broken Code

This was obviously a CSS problem since I didn’t have that problem in Neonlabs. So I used several tools to see which was the offending style. I mostly looked for the ‘pre’ tag on CSS but was not successful. After looking through the whole CSS style for my theme, I found the offending line of code:

#primary code {
	display:block;
	...
}

Yep, it was a simple display attribute. I just commented that line and everything just worked.

Fixed Code

After that I tried editing the code to make it look better for the Structum page and I noticed that when it loaded it had a nasty Warning:

Warning: htmlspecialchars_decode() expects parameter 1 to be string, NULL given in /…/wp-includes/compat.php on line 105

And when I looked at the code blocks in my posts, there was nothing. They were empty.

I did a little research to see what was the problem, and it seems it is a WordPress bug. Simple variable naming bug in compat.php:

	function htmlspecialchars_decode( $str, $quote_style = ENT_COMPAT )
	{
		if ( !is_scalar( $string ) ) {
			trigger_error( 'htmlspecialchars_decode() expects parameter 1 to be string, ' . gettype( $string ) . ' given', E_USER_WARNING );
			return;
		}
	...
  	}

Can you see the problem ? The problem resides in the $string variable. It doesn’t exist, so its value is null. Changing the variable parameter for is_scalar and gettype from $string to $str fixed the problem.

This is how it should look:

	function htmlspecialchars_decode( $str, $quote_style = ENT_COMPAT )
	{
		if ( !is_scalar( $str ) ) {
			trigger_error( 'htmlspecialchars_decode() expects parameter 1 to be string, ' . gettype( $str ) . ' given', E_USER_WARNING );
			return;
		}
	...
  	}

After that, everything is working seamlessly again :D. hope this helps :D.

New Code Hiliter!!!

// November 4th, 2006 // Comments Off on New Code Hiliter!!! // Site, software development

I just began using iG:Syntax Hiliter, it rocks!!!! I changed the face to the highlighter I use in emacs

Just in case you don’t like the pretty colors, just click on PLAIN TEXT, it will give it to you plain…

Site redesign

// August 5th, 2006 // Comments Off on Site redesign // Site

I finally took a decision to keep wordpress as my site’s engine. I was thinking on rewriting my site using moebius lib, but I am too lazy. WordPress works fine. So I went ahead and made some design modifications. I’m getting to know how wordpress works. I may be changing my whole site to wordpress by the end of the month.

BTW, this site’s design looks a lot like my first one. Talking about deja-vú.