Wednesday, August 30, 2006

damn you sessions

So, I am working on a project for HereNextYear. Basically, they have a client "Childrens Cancer Fund" and I am re-working their online donation page to work with Authorize.Net . Fun Fun. It also allows them to have teams sign-up, kinda like when people come to your house for a 5K run pledging how much money they will do. However, the teams have their own little page, with the donation form on it. So using some mod_rewrite I have it so they can do www.domain.tld/TeamName/ and it will pull data from a database based on their team name. Well I was having problems in the fact that, on one section of the page it returned the team_id session as one number, while on a different part of the page it returned something else. After 2 days of dicking with it, I finally found the solution, because of another session variable, I managed to catch the value and it was odd. What makes things weird is, 1. it was html that wasn't even wrapped around <?php ?>. 2. Why it was actually causing the problem. So here is the bugged code.

<body bgcolor=#ffffff marginwidth="0" marginheight="0" leftmargin="0" topmargin="0" bottommargin="0" background="images/ccf_bg.gif">

Here is the fixed code
<body bgcolor=#ffffff marginwidth="0" marginheight="0" leftmargin="0" topmargin="0" bottommargin="0" background="<?php echo PATH_TO_DISPLAY; ?>/images/ccf_bg.gif">

Basically I have a PHP constant that holds the url to the base project. That way, with the mod_rewrite I don't get anything funky like, www.domain.tld/teamName/images/ccf_bg.gif . Thats what the PATH_TO_DISPLAY is. That was my fix. After 2 days, it turns out something so random I just don't know what else to say..

Well thats it, for now. I gotta get this thing done.

2 comments:

Unknown said...

Shouldnt you be using CSS instead of attributes on the body tag?

Jeff said...

In most cases yes. However, I was doing the backend for the site and the design/layout had already been done. So in this case, it wasn't my call to make.