Recently, I decided to give IIS another try in preparation for learning the WCF Framework. I also decided to try PHP as well with IIS (7.5 in this case).
Unfortunately, I ran into some issues with installation as I tried to install PHP 5.4 along with IIS. The actual installation and use of PHP worked, however, I couldn’t figure out why PHP was looking in “C:WINDOWS” for my php.ini, rather than the actual directory where I (then) extracted PHP to. I noticed later, when I downgraded to 5.3 since it had an installer available, rather than just a .zip download.
If you are setting up PHP with IIS, manually or via installer, you need to log the HTTPd’s account out of Windows and back in again. The issue mentioned above is PHP is looking for “php.ini” in “C:WINDOWS” which is undesirable. The PHP 5.3 installer edits your Windows PATH environment variable to include “C:PHP” (or wherever you installed PHP). Windows doesn’t associate this change until you logout and log back in again.
If you happen to install it manually, edit your path variable to include your PHP directory. See the screenshot for other details that would be useful.
This was done on Windows 7 Professional, 64-bit.
Alright, so I was confused by the PHP Docs on array_walk. So, I wrote a little example to try to figure out how it works. I did so because the PHP documentation on the function was a bit unclear in my opinion.
The basic structure for array_walk is:
array_walk( array $myarray, function(&$val, $key) );
That said, you can see my usage here and the corresponding output it provides.
Alright, I’m pretty sure this has been done before.
Scenario: I need to access bloginfo() function from inside a script block on my custom theme.
Solution (partial): A partial solution to this is easily remedied with minimal code. However, this solution only allows default bloginfo() to be retrieved.
The following function goes inside your theme’s functions.php file:
static $_bloginfo = array( 'name', 'description', 'admin_email', 'url', 'wpurl',
'stylesheet_directory', 'stylesheet_url', 'template_directory', 'template_url',
'atom_url', 'rss2_url', 'rss_url', 'pingback_url', 'rdf_url', 'comments_atom_url',
'comments_rss2_url', 'charset', 'html_type', 'language', 'text_direction', 'version' );
$jsArray = array( );
foreach ($_bloginfo as $key)
$jsArray[$key] = get_bloginfo($key);
var bloginfo = <?php echo get_the_bloginfo_array();?>