Archive for the 'Coding' Category

Extending a Sidebar All The Way Down

Saturday, November 7th, 2009

This is an issue I’ve had some trouble with, and finally spent some time to figure it out.

The problem is, when trying to make a sidebar, the sidebar would not extend all the way to the footer unless there was content in it. In order to fix this, you need to do two things in your CSS.

1st, you must define your body to have a height of 100%. Then, in your sidebar div you then define that with a height of 100%. YOU MUST BOTH OF THESE. Here is what it should look like:
body {
font-family: Verdana, Arial, Helvetica, sans-serif;
/* Allow IE/Win to resize the document */
font-size: 80%;
color: black;
background: #ffffff;
margin: 0;
padding: 0;
border: none;
height: 100%;
}
#sidebar {
width: 340px;
float: left;
clear: both;
margin-bottom: 4em;
padding: 20px;
height: 100%;
}

Contact Form on Joomla….ARGHHHH!!!

Thursday, January 18th, 2007

On one of my sites, I decided to go with Joomla. I liked the idea of Joomla because of the ease of installation, plus it was an overall fit for the site theme.

One of the problems I am encountering is making the contact form functional. It seems as though no matter the functions I choose, nothing will work. I have to suspect that my host, Dreamhost has something to do with it.
Joomla Email Contact Form
I went to their wiki, and found some good examples. However, I set things up as shown in my image and the mail never get to me. I have tried several different email addresses on different servers, and nothing works. This will prove to be an ongoing dilemma and more than likely will be posting again on it!

Adsense Code in Smarty

Saturday, January 6th, 2007

I own several websites that are link directories. Most of them are run on the phpLD Link Directory script. One of the more challenging parts of maintaining and getting these directories going is dealing with Smarty. Before I knew any better, I would get frustrated when trying to add code, then not seeing the end result on the page displayed.

Smarty does weird things, as I’m still learning and understanding.

A prime example of this is adding Adsense code to template files. I was attempting to add Adsense code to one of my templates, and I simply added my Adsense code.

The result was not what I planned. The ads displayed, but were not correct as shown here.(Image at 75% scale)

Adsense Code with Smarty

The ad just didn’t look right, and it seems as though the “ads by Google” text was missing.

After doing some investigating, I learned that I had to add “literal” tags around the code as such:
{literal}
Adsense code
{/literal}

This was much better, as it produced the desired ad:

Adsense ads with code

I still run across confusion when I attempt to do other things similar, and still cannot figure them out. These are growing pains, I’m sure as I will eventually grow out of them.

Snap Preveiw

Tuesday, January 2nd, 2007

Snap Preview

Several days ago, I came across a site (I don’t recall where) and noticed the new service by Snap. It’s a link preview box that opens when you hover over an active external link from a website.

I liked this feature. I think it adds something that benefits the viewer of your site.

I was amazed at how simple this feature is to add to your site.

To get this working on your site, all you have to do is visit the Snap website, enter your url and a valid email address then you are given a code to place before your /head tag.

I have since added this feature to several of my sites, including this one.

Changing Header Images Based on Date

Monday, December 25th, 2006

I wanted to “Christmas Up” my forums by changing my header image to something a bit more seasonal. I created a new logo and was curious about automating this change. Maybe I can have different logos for the different seasons, etc.

I looked to the Digital Point Forums and found my answer. A big thanks to JEET who answered my dilemma with the following:

Try this code:
(Assuming your images are stored in a folder called “images”, 1 directory below where the code is executed.)
$mdarr= "18-25/12,13-20/05";
$miarr= "christmas.jpg,happy_birthday_jeet.jpg";

// Format explained below and why use this.

$jtd= date("d");
$jtd= $jtd-7;// Minus 7 days to match above format.
$jtd= $jtd . '-'. date("d"). '/' . date("m");
$jc=0;
$r= explode(",",$mdarr);
foreach($r as $v)
{
if($jtd==$v)
{
++$jc;
}
}
if($jc>0)
{
--$jc;
$img= explode(",", $miarr);
$img= $img[$jc];
print '
'. $img. '
';
}
else
{
print '
default logo
';
}
?>

About the date format.

$mdarr= "18-25/12,13-20/05";
Here you can fit an array for all the dates you wish to change your image on.
For example 25/12 (25 December.) Minus 7 days makes it:
18-25/12, so your image starts appearing 7 days before the actual festival.
Add a "," sign and enter another date in same format.
(Minus 7 days)-(Actual date)/(month)
Add as many as you like.

Which Image to use:
$miarr= "christmas.jpg,happy_birthday_jeet.jpg";

Just enter the full image file name for each date at the same "number" position as it appears in date array.
Seperated by "," sign.

18-25/12 was first item, so "christmas.jpg" is first in this array.
and so on.

Then replace the img tag for your logo with this code above.
Fill the array once, and probably will never have to touch it again...