Jump to content

Custom Function not creating a table correctly


Glenugie

Recommended Posts

Okay, so I have a function (shown below) that is designed to create a grid square (represented in a map) that takes in various values, overall the function works fine, but the problem arises with Colspan and Rowspan, the table does not pay attention to these and displays them as colspan & rowspan = 1, no matter what values are entered, normally I would assume it was just a problem with my typing, but the page source shows that the values are being taken, and in all sense, it should be displayed.

 

//Map Grid Square
function MapGridSquare($Image, $Width, $Height, $Title, $Link, $Colspan, $Rowspan) {
echo "<td width=0 height=80";
if ($Colspan!="") { echo " colspan=".$Colspan;}
if ($Rowspan!="") { echo " rowspan=".$Rowspan;}
echo ">";
if ($Link!="") { echo "<a href=".$Link.">";}
echo "<img src=".$Image." width=".$Width." height=".$Height." border=0 alt='".$Title."' title='".$Title."'>";
if ($Link!="") { echo "</a>";}
echo "</td>";
}

 

The function is used in the following context:

 

MapGridSquare("Fill.jpg", "86", "98", "Empty", "", "2", "2");

 

If anyone could tell me what the problem is/might be, it'd be greatly appreciated.

 

Thanks in advance :)

Okay, so I have a function (shown below) that is designed to create a grid square (represented in a map) that takes in various values, overall the function works fine, but the problem arises with Colspan and Rowspan, the table does not pay attention to these and displays them as colspan & rowspan = 1, no matter what values are entered, normally I would assume it was just a problem with my typing, but the page source shows that the values are being taken, and in all sense, it should be displayed.

 

//Map Grid Square
function MapGridSquare($Image, $Width, $Height, $Title, $Link, $Colspan, $Rowspan) {
echo "<td width=0 height=80";
if ($Colspan!="") { echo " colspan=".$Colspan;}
if ($Rowspan!="") { echo " rowspan=".$Rowspan;}
echo ">";
if ($Link!="") { echo "<a href=".$Link.">";}
echo "<img src=".$Image." width=".$Width." height=".$Height." border=0 alt='".$Title."' title='".$Title."'>";
if ($Link!="") { echo "</a>";}
echo "</td>";
}

 

If anyone could tell me what the problem is/might be, it'd be greatly appreciated.

 

Thanks in advance :)

 

To be completely honest you should take another look at what is going into the function because it isn't doing anything to those two variables. It's not the functions fault.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.