Glad you figured a workaround -- sorry I did not fully grasp the problem. You may want to look at my PHP-Snippets plugin: http://wordpress.org/extend/plugins/php-snippets/
It lets you put PHP into your posts and pages via shortcodes ... maybe you can create the PHP code you need using that.