Archive for the ‘Web Development’ Category

Mar
0

One for my geek friends

One for my geek friends
powered by WordPress Multibox Plugin v1.3.5

tumblr kxwp33RcVV1qacw02o1 400 One for my geek friends

This might be the funniest HTML joke I?ve ever seen. Of course you know the i tag has been deprecated in XHTML.

repost from http://joeschmitt.tumblr.com/post/391725635/via-blueyesbrunet-this-might-be-the-funniest

Feb
0

Connecting to Magento via XML-RPC

I have been trying off and on for about a week to get a connection made to Magento’s API via a PHP script.

Magento gives the following code snippet on their site, but I could not get it to work – souring the message boards didn’t really help either.  I am not sure if something was off with my installation instance or what.

  1. $client = new Zend_XmlRpc_Client(‘http://youmagentohost/api/xmlrpc/’);
  2. // If somestuff requires api authentification,
  3. // we should get session token
  4. $session = $client->call(‘login’, array(‘apiUser’, ‘apiKey’));
  5. $client->call(‘call’, array($session, ‘somestuff.method’, array(‘arg1′, ‘arg2′, ‘arg3′)));
  6. $client->call(‘call’, array($session, ‘somestuff.method’, ‘arg1′));
  7. $client->call(‘call’, array($session, ‘somestuff.method’));
  8. $client->call(‘multiCall’, array($session,
  9. array(
  10. array(‘somestuff.method’, ‘arg1′),
  11. array(‘somestuff.method’, array(‘arg1′, ‘arg2′)),
  12. array(‘somestuff.method’)
  13. )
  14. ));
  15. // If you don’t need the session anymore
  16. $client->call(‘endSession’, array($session));

After a bunch of trial and error – scouring the web etc – i was finally able to make a connection with the following script

<?php
ini_set("display_errors", 1);
error_reporting(E_ALL);
define("XMLRPC_DEBUG", 1);

require_once('../app/Mage.php');
$client = new Zend_XmlRpc_Client('http://www.domain.com/api/xmlrpc');

// If somestuff requires api authentification, we should get session token
$session = $client->call('login', array('user', 'key'));

echo "<pre>";
print_r($session);
echo "</pre>";

// If you don't need the session anymore
$client->call('endSession', array($session));
?>

one strange thing to note is the path to the API – with a trailing slash, i could not get this to work…’

I hope that this helps someone else out.

Jul
0

WordPress Error Fix

recently after installing a plugin i got an error from WordPress that looked something like this.

Warning: mysql_error(): X is not a valid MySQL-Link resource in (path) on line Y

(Warning: mysql_error(): 9 is not a valid MySQL-Link resource in /var/www/vhosts/XXX/httpdocs/wp-includes/wp-db.php on line 282)

i found the solution here and thought that i might post the fix

http://scripts.indisguise.org/2007/04/05/using-non-plugin-third-party-scripts-with-wordpress-212/

Apr
0

Getting Root ID from embeded pages

powered by WordPress Multibox Plugin v1.3.5
wordpressicon hanttula2 Getting Root ID from embeded pages

For quite a while now I have been using the following script to show sub navigation on WordPress Sidebars. It utilizes the built in wp_list_pages function to show parent and child relationships on a sidebar (or where ever you choose to use it for that matter).

<?php

if($post->post_parent)
$children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0");
else $children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0"); if ($children) { ?>  <ul> <?php echo $children; ?> </ul> <?php } ?>

I like that it is simple, and that it can be re-written to show items only if they are child pages of a specific parent, ie:

<?php
// find out what the top level page is

global $post;
if($post->post_parent) $parentPG = $post->post_parent; // page is a child
else $parentPG = $post->ID; // page has children
?>

<?php

// marketing

if($parentPG==7){

// show items if the parent id is 7
}elseif($parentPG==8){
// show items if the parent id is 8
}
?>

This works great when you only need to make it work with parent and child pages. Recently, however, I had the need to utilize this type of functionality on a project that required pages 3 levels deep (grandchildren?). After a bit of Googling, and searching through the WordPress Codex I realized that I was going to have to “roll my own” on this one. So here you go – there are probably better ways of doing this. If you know of one please let me know, but maybe this will help someone else searching for “wordpress list grandchildren”

<?php
// find out what the top level page is
global $post;
if($post->post_parent){
$parentPG = $post->post_parent; // page is a child

// check for grand children
$sql = "SELECT * FROM `".$wpdb->prefix."posts` WHERE ID=$parentPG";
$data = $wpdb->get_results($sql,ARRAY_A);

if(!empty($data[0][post_parent])) $parentPG=$data[0][post_parent];
}
else $parentPG = $post->ID; // page has children
?>

<?php

// marketing
if($parentPG==7){
// show stuff for parent 7
}elseif($parentPG==8){
// show stuff for parent 8
}
?>
Mar
0

testing wordpress 2.5 gallery

Mar
0

WordPress 2.5 Debut

well it finally happened after what seems like a rather long wait, WordPress 2.5 with its completely re-designed admin system is hot off the presses and ready to install.  I have done the upgrade on a handful of blogs and sites so far and it’s been seamless.  I am very impressed with the new admin – all in all it’s taken a product that I think is great and only made it better.

Great Job!

Mar
0

WordPress 2.5 Admin

So i installed WordPress 2.5 release candidate 1 on this site so that i can familiarize myself with the new features, and I have to say, my first reaction is WOW!  The new admin is a much cleaner look and feel.  The new functionality is amazing.  There is integrated support for video, all I can say is I can’t wait until this is available as a full release.  It’s going to knock people’s socks off!

Way to go WordPress.

Mar
0

WordPress 2.5 sneak peak

http://wordpress.org/development/2008/03/25-sneak-peek/

sounds cool – i can hardly wait.

Mar
1

Modifications to Media Temple DV default configurations

At Invisible Window we have been hosting our client sites in addition to our own with Media Temple for quite some time. Media Temple’s service and support has been top-notch. There are a few things that we’ve had to figure out along the way and I hope that these links help someone else out there.

  1. Disable root ssh access: instructions for disabling the root user and allowing another user to assume the root users permissions. This adds a layer of security requiring an additional username and password to be entered before gaining root user privileges.
    Media Temple Knowledge Base Article
  2. Performance Tuning: This article summarizes ways to optimize your (dv) to run with less memory / resources, increase stability, and to ensure higher availability under heavier loads.
    Media Temple Knowledge Base Article
  3. Raise Courier-IMAP Connections: Seeing this message when accessing your email? “Unable to connect to your IMAP server. You may have exceeded the maximum number of connections to this server.”By default, Plesk and the Courier-IMAP e-mail server drastically limit the number of inbound connections to prevent users from opening up too many concurrent sessions. Unfortunately, this restriction can impact legitimate users who have multiple computers connecting to the Courier-IMAP server.
    Media Temple Knowledge Base Article
Mar
0

missing…WordPress 2.5

The blogsphere buzz surrounding the release of WordPress 2.5 has indicated that it will be released today…but as of yet, nothing. I am looking forward to this release as it has made significant upgrades to the admin system, and I am curious how all of the various themes and plugins jive with it. My plugin curiosity especially surrounds Google Mapper, a plugin we wrote at Invisible Window.

So stay tuned…i will let you know when 2.5 decides to grace us with its presence.