Archive for the 'tips and tutorials' Category

 

Syntax highlighter activated

Wednesday, October 11th, 2006

Well it goes like so . . . Thanks goes to Peter Ryan. Great visual enhancement.


	function show_photos_main() {
		$album = $_GET['album'];
		$photo = $_GET['photo'];
		$page = $_GET['page'];
		$tags = $_GET['tags'];
		$show = $_GET['show'];

		$output = '';
		$continue = true;
		if (!is_null($show)) {
			if ($show == 'tags') {
				$output = $this->show_tags();
				$continue = false;
			}
			elseif ($show == 'recent') {
				$tags = '';
			}
		}

		if ($continue) {
			// Show list of albums/photosets (none have been selected yet)
			if (is_null($album) && is_null($tags) && is_null($photo)) {
				$output = $this->show_albums($page);
			}
			// Show list of photos in the selected album/photoset
			elseif (!is_null($album) && is_null($photo)) {
				$output = $this->show_album_thumbnails($album, $page);
			}
			// Show list of photos of the selected tags
			elseif (!is_null($tags) && is_null($photo)) {
				$output = $this->show_tags_thumbnails($tags, $page);
			}
			// Show the selected photo in the slected album/photoset
			elseif ((!is_null($album) || !is_null($tags)) && !is_null($photo)) {
				$output = $this->show_photo($album, $tags, $photo, $page);
			}
		}

		if ($this->has_error) {
			$this->template->reset('error');
			$this->template->set('message', $this->error_detail);
			$output = $this->template->fetch();
		}

		return $output;
	}

Kubrick and WordPress

Wednesday, September 6th, 2006

Switch

Okay I made a decision. Let’s go back to basics. After spending much time in trying all sorts of themes I switched to the default WordPress theme Kubrick by Michael Heilemann. The themes I have tried out so far:

To name just the ones I enjoyed quite a bit. Another theme that caught my attention for it’s nice layout and use of AJAX snippets is ‘Lush’ from Marco van Hylckama Vlieg and Christoph Boecken. I haven’t decided yet for it has some limitations on the way it’ll render on FireFox.

So why the change to Kubrick?

Well I was a bit bored. It clearly seems that the more a theme offers in colors, layout, useability the faster it bored me. Anyway that’s one explanation. Another might be that I am still charmed by the raw simplicity that Kubrick offers. It’s almost like this theme is the foundation of all blog-themes. And maybe it is. Offcourse I adjusted one thingy or two. To name a few modifications I have made:

  • Added LiveSearch AJAX powered search, instead of the default/conventional search method, by John Nunemaker.
  • Altered the rather dull <h2> font family by a more stylish one, Century Gothic. I like it’s typography more.
  • Added a more efficient way to navigate my blog by use of Liew Cheon Fong’s ‘SuperNav-bar’.

The plugins I use

And a few more I didn’t mention because it’s use isn’t visible on the blog but in the admin section.

Another nice feature I discovered was the Kubrick-Headermaker a.k.a. “Kubrickr” by Owen Winkler at RedAlt. You really should try it out. I realize that this might be old information but I was glad I found it. Result…look at the header image. Like it?

Conclusion

I am defnitely going to change again. I just love the work in getting a theme modded to my likings and making it XHTML Strict 1.0.

Wishes for Kubrick

I am still very interested in more AJAX control. This site is powered with the Script.aculo.us scripts. But other, maybe lighter/easier script suites are waiting like Moo.FX. And even maybe Ruby on Rails stuff. I have a lot todo. But to stick with Script.aculo.us seems difficult because of its bugs. In certain situations IE and FF crash because of Script.aculo.us. That’s a pitty.

ClearerType

Friday, September 1st, 2006

Internet Explorer Features

A nice new feature of IE7 I noticed last week: ClearType is now a browser-specific feature.

ClearType in IE7, overlaying pixellated text in IE6

When Windows XP was released in 2001, Microsoft launched ClearType as a way of smoothing on-screen fonts. Great, except for some reason, it was off by default. Most users never found the setting to enable it, so for the past 5 years, we’ve still had to assume users are seeing ugly pixellated fonts on the web.
But Vista aside, even in the forthcoming IE7 for XP, ClearType is a browser-specific setting and it’s enabled by default. Combine this with IE7’s presumed quick march onto user’s systems, and we’re going to see a whole lot of ClearType in the near future.

Preferences dialogue window highlighting ClearType switched on

Nicely done, IE team.

Ecto for WordPress

Thursday, August 31st, 2006

The previous post said things about Microsoft’s Live Writer for Windows. Now I am scribbling something down about Ecto. Yes, I know, this thingy costs money and the other is absolutely free. Since I am a somewhat adventurous type I decided to put some money where my mouth is and spent EURO 17.80. I think that’s quite reasonable. Thing is that for some absolutely unknown reason, and believe me I have tried every option in the WordPress book, I can’t save my posts. It’s probably a Windows thing. So these came on my path. Live Writer is free intuitive enough but lacks certain features that we WordPress bloggers need. The main thing are the tags. Ecto provides these. Amongst other features. So spent some euros and using Ecto is a relieve. You can always try the 20 day trial if you want, it’s worth a shot.

faster and faster…

Thursday, March 2nd, 2006

Will this go any faster?

Slow is a pain in the …. So I had to get things faster. I am not praised for my patience so I need things fast. Posts, pages, scripts, all faster. Huh. Am I losing it? No, stuff, pc’s and so on must work with lightning speed. I am a dutchie, so in Holland we say “You paid for it so I want it”. How many transactions per nano-/millisecond? Millions, trillions? Don’t know. But WP is sooooo damned slow I had to crank it by hand almost. Found a solution. One who isn’t strong must be smart, ain’t that so! I found Owen Winkler through (who else) Lorelle. Owen had it. A twin-turbo to boot WP into sixth gear, I hope. Take advantage of it, use it, drive a Ferrari or a Beetle? Your choice.

 

Update:

Yes ladies and boys, it certainly is faster. Testdrive came out at 200mph. Not bad for WordPress version 2.01 hey? Let’s hear it for WordPress.

XHTML Strict Validation Update

Wednesday, March 1st, 2006

Filtering my XHTML code again

The past few days I have made the go ahead for myself to start with recoding everything to meet XHTML Strict 1.0 standards. Yes, it is quite a job to start with. But it gives such a feeling of satisfaction. This site was already up to the Transitional Standards so it wasn’t too painful a task.

Adjusting the html tags

The main issues I had to deal with were the link tags. It is forbidden to use the oh so loved “target” attribute so that had to go. At first I was fiddling with inline javascripting but that was too intense. Had to let that one go. Until I stumbled on this from the people at Sitepoint. A very nice javascript that could be used from a remote file. In the head of the page I had to call it using <script src=". Benefit is that is was there whenever, i.e. always. Secondly I had to activate the script using the onload event in the body tag. No problem whatsoever. The script does something very nice (browser independent) with the DOM. It calls a XHTML 1.0-valid attribute, which you must provide in your links, called the “rel” (relationship) attribute. Then it transforms this to the deprecated attribute “target” again but only in the background, it will not be parsed to the browser. Hence it’s validity! A few tweaks in the WordPress coding and presto. No more cumbersome extra typing those target attribs. It’s now a part of WP, voila :!: Ofcourse the ‘target’ deprecation is only one of many. I had to go at a load more others to get validated. You can read all of the differences at the W3C site itself to learn more about XHTML Strict 1.0 a very informative piece. Something else for a change at W3C I think ;)

WordPress tweaks for the ‘external’ links

Again it is “Quicktags” time…Just add this code in your /wp-includes/js/quicktags.js file:

edButtons[i].tagStart = ‘<a rel="\external\" title="\External link\" href="’
+ URL + ‘">’;

But hey, how about my ‘blogroll’ list:?: There are external links there aswell. How do we modify those:?: For they are only accessible by means of the WordPress Admin sections. Not a problem. In your /wp-includes directory open the file ‘links.php’. Look for this line:

$output .= ‘<a href="’ . $the_link . ‘"’ . $rel . $title . $target. ‘>’;

at line number 243. Then modify it as follows:

$output .= ‘<a rel="external" href="’ . $the_link . ‘"’ . $title . $target.’>’;

Notice the addition of rel="external". That is the trick. All the links in the blogroll added by you in the WP-admin will now have the extra ‘rel’ attribute in them. Again, be very carefull what you do. Make backups first then go and edit.

Some pointers to get your Strict way

  • Lorelle VanFossen has made it a shear quest to tell you all there is for making webpages, valid, accessible and just plain accurate. Go and have a look there. Her posts maybe quite lenghty but persisting in reading them makes one a whole lot wiser.
  • Start simple. In making all the changes from, let’s say HTML 3. something to XHTML Strict might be quite a step to make. Maybe first going to HTML 4.01, then XHTML Transitional is better.

One site you will see a LOT :!: is ofcourse this. . . . the VALIDATOR. The hyperlink I just mentioned states /referer, that is your URL or URI or plain and simple your website’s address, i.e. “http://www.yoursite.com”. Use it well, it is a real live saver. Happy coding . . .

Another WordPress Error and Fix

Friday, February 24th, 2006

WordPress 2.01 still bugged with errors

Unfortunately WordPress 2.01 still suffers from some anoying bugs. In order to get my nicer archives up and running I ran into an very annoying error. I tried to get a page saved and it produced this error on screen. The socalled WSOD was immently visible. Not a pretty site to see :(

Fatal error: Call to undefined method WP_Rewrite::flush_rules() in X:\yoursite.com\root\wordpress\wp-includes\functions-post.php on line 200

Hmmm, not so good… So a search on WordPress Trac for the solution was done. That’s more difficult then I expected. The exact error message wasn’t there at all. So I searched for hopefully related issues. This is what I came up with. A fix in the file ‘functions-post.php’ (resides in your wp-includes folder). Ah yes, important :!: , this implies only in the full WordPress version.

Remedy

  • The new file functions-post.php you can download here.

But, as always, be careful, make a backup of the ‘old’ file first, for instance by renaming it, then use the new file. After, test your functions in WordPress and test your website. All should be in order.

Conclusion

My first feeling is that saving your posts and/or pages goes faster then before. Could be only a feeling. I can’t verify this on hard evidence. But it certainly gives a reassurring feeling nonetheless. In the WordPress Trac changeset #3525 it states the fix has something todo with time-date manipulation by WordPress. I am interested to know how this can relate to my problem? Anyway I considered it a good idea to keep you informed about this. We aren’t out of the bug-valley yet. But I am very much confident it will be fixed by those magnificent people at WordPress.

WordPress 2.01 bug and fix

Sunday, February 19th, 2006

A bug in WordPress 2.01 detected

Hello everyone! During my ever continueing quest on housekeeping I stumbled on a nasty bug in WordPress. This happened after my risky upgrade to WordPress 2.01.

RSS, XML, FeedBurner feeds

What happened :?: When clicked on the badges on my sidebar I only got ‘comments’ feed. This happened for all the syndicates (XML, RSS). A search on the WP-forum delivered me with this post. I would suggest to all WP 2.01 users to read it and fix it with a few extra pointers from me. The bug report is rather sparse in how to fix this problem.

Fix the Feed Bug in WordPress 2.01

Open up the file “classes.php”. It is in the directory /root/wordpress/wp-includes/. Search for line number approx. 1299. There you see this:

// Comments
$comments_rewrite = $this->generate_rewrite_rules($this->root .
$this->comments_base, true, true, true);
$comments_rewrite = apply_filters(‘comments_rewrite_rules’, $comments_rewrite);
// Search

The problem lies in this line from the part listed above.

$this->comments_base, true, true, true);

It is not complete. Fix:

The FIX

Just edit that line until it reads:

$this->comments_base, true, true, true, false);

Notice the addition of the boolean ‘FALSE‘?
When added and uploaded my problems were over.
I hope it will help your feeds too.