Jump to content

issue with parameters


Marvin0410

Recommended Posts

Hello all,

 

I'm kind of a noob to PHP, and as such have been teaching myself the language.

 

I'm attempting to insert tag attributes in divs, based on whether the site is viewed in IE or Firefox, to account for subtle differences in appearance. The problem, however, is that the variable $boxorlink apparently has the value "box" the second time I call the method, even though I explicitly state "other" as the parameter; the else clause is never reached.

 

If anybody could tell me why this is happening, please let me know. My entire HTML code is below...

 

<html>

<head>

 

<style type ="text/css">

 

html {

background-image:url('denim.jpg');

 

}

 

.wrapper {

min-width:600px;

width:600px;

height:800px;

position:fixed;

}

 

.headertext {

font-weight:bold;

color:#FFFFFF;

font-size:24pt;

font-family:sans serif;

text-shadow: 0.1em 0.1em #333

}

 

.miniheadertext {

font-weight:bold;

color:#FFFFFF;

font-size:16pt;

font-family:sans serif;

text-shadow: 0.1em 0.1em #333

}

 

div.transbox

  {

  width:750px;

  height:180px;

  margin:30px 50px;

border-style:solid;

border-color:#c0c0c0;

  background-color:#000000;

  /* for IE */

  filter:alpha(opacity=30);

  /* CSS3 standard */

  opacity:0.3;

  }

 

div.currentpagelink {

width:90px;

height:22px;

margin:30px 50px;

background-color:#c0c0c0;

font-color:#FFFFFF;

font-weight:bold;

font-size:14pt;

font-family:sans serif;

text-align:center;

 

/* for IE */

  filter:alpha(opacity=40);

  /* CSS3 standard */

  opacity:0.4;

  }

}

 

div.otherpagelinks {

width:100px;

height:50px;

font-size:14pt;

font-family:sans-serif;

}

 

 

</style>

 

<title> Marvin Serrano's Online Portfolio </title>

<?php

function checkBrowser($boxorlink, $left, $top, $displaceleft, $displacetop)

{

 

//new positions for Firefox

$newleft = $left + $displaceleft;

$newtop = $top + $displacetop;

 

//positions for links...

$newlinkleft = $left - $displaceleft;

$newlinktop = $top - $displacetop;

 

//checks for box on top or links; links have to be certain % from top.

if ($boxorlink = 'box')

{

if (strpos($_SERVER['HTTP_USER_AGENT'],'MSIE') !== FALSE)

{

echo('left:'.$left.'%');

}

else

{

echo('left:'.$newleft.'%');

}

}

elseif ($boxorlink = 'other')

{

 

if (strpos($_SERVER['HTTP_USER_AGENT'],'MSIE') !== FALSE)

{

echo('left:'.$left.'%;'.'top:'.$top.'%');

}

else

{

echo('left:'.$newlinkleft.'%;'.'top:'.$newlinktop.'%');

}

}

 

}

?>

</head>

 

<div class="wrapper">

 

<div class ="transbox" style="position:absolute; <?php checkBrowser('box',19,0,9,0) ?>">

<div class ="headertext" style="position:absolute; left:30%; top:30%">MARVIN SERRANO</div>

<div class ="miniheadertext" style="position:absolute; left:29%; top:55%">Live for today, dream for tomorrow.</div>

</div>

<div class ="currentpagelink" style="position:absolute; <?php checkBrowser('other',38.1,26.3,10.1,3) ?>">

Home

</div>

 

<div class="otherpagelinks">

 

</div>

</div>

 

</html>

 

-Marvin

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.