Category: Web Design and Development


Well this took a big chunk of time last night so I thought I’d start a post here with the info I collect. Here’s the .htaccess text for parsing PHP in HTML files on various hosts.

Network Solutions

AddType application/x-httpd-php .html
AddHandler Extension_Type .html .htm .php3 .php4 .php5
Action Extension_Type /cgi-bin/php.dat

HostGator

AddHandler application/x-httpd-php5 .htm .html

I’ll add more as I run across them.

There are a number of plugins and tutorials for adding a gravatar image to the meta info for WordPress posts.  But my client wanted the ability for each other to upload/maintain their own images within their WordPress profiles. Here’s how I did it.

First  I installed the plugin Author Image – this places a simple upload box at the bottom of a user’s profile page. Nice and simple.

Next, I used the code snippet provided for the plugin and added it to the .entry-meta section beside the author link in my template page:

<?php the_author_image(); ?>

I styled it to make it smaller, but again this was an easy task. Next, I wanted to make the image link to the author’s posts page – that proved to be harder than expected, but eventually I got it working thanks to a post I found about an outdated user image plugin:

<?php
$author_id=$post->post_author;
$curuser = get_userdata($author_id);
$author_post_url=get_author_posts_url($curuser->ID, $curuser->nicename);
echo 'user_nicename ) . '" ' . '>';
the_author_image();
echo '';
?>

Easy to implement and my client’s authors can control their image from within their profile rather than having to update a gravatar.

This is such a cool-looking gallery – I haven’t had an opportunity to use this yet, but one of my potential upcoming projects may provide the perfect opportunity.

Sometimes an application may ask for an absolute path to a folder/file in your hosting account. Finding that can be hard – you often have to dig around on your host’s site or contact them for that info.

Here’s an easy way to do it: create a new .php file and upload this to the account.

<?php
$path = getcwd();
echo "Your absolute path is: ";
echo $path;
?>

Then just navigate to that file in a web browser and it will display your absolute path.

I use NextGen Gallery for WordPress often, I think it’s a fairly solid solution with a few quirks that I can work around.

Today I’m working on a multilevel gallery for a local architect. I have a number of galleries within each album, and I wanted to show the album name and gallery name for each of them to help the visitor keep track of where they are in the stack.

To do this, go into /wp-content/plugins/nextgen-gallery/view/ and open gallery.php.

Add this line to the very top of the page:

<?php $album = nggdb::find_album( get_query_var('album') ); ?>

Then, scroll down to about line 72 and just before the thumbnails section comment, add this:

<?php echo $album->name?>: <?php echo $gallery->title?>

This will give you a nice-looking, dynamic headline like:

Album Name: Gallery Name

This morning I’ve been hunting around for a solution to a client’s problem – getting internal links to work within a scrollable div. It was more difficult than I thought it might be.

The problem was that when you click on a link to an anchor tag within the same page, the entire page wants to scroll up so that the anchor tag is near the top of the browser window. Because my client’s design is a pretty small content area in the middle of the screen, that didn’t work well. I needed to find a solution that would only affect the content within a single scrollable div.

I looked at a number of jQuery options that didn’t really pan out. About 10 minutes ago I found a little free script called SoftDivScroll. It was extremely easy to install and configure, and it works beautifully in FF, Chrome, Safari/Win, Opera, and IE 8/7/6.

I just sent the author a little donation for this timesaving script.

© 2012 position: relative; All rights reserved. Powered by WordPress.