Glenugie Posted February 23, 2010 Share Posted February 23, 2010 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 Link to comment https://forums.phpfreaks.com/topic/193119-custom-function-not-creating-a-table-correctly/ Share on other sites More sharing options...
aeroswat Posted February 23, 2010 Share Posted February 23, 2010 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. Link to comment https://forums.phpfreaks.com/topic/193119-custom-function-not-creating-a-table-correctly/#findComment-1016999 Share on other sites More sharing options...
teamatomic Posted February 23, 2010 Share Posted February 23, 2010 If colspan and rowspan are always giving a value of 1 then it is likely that whatever conditional you are using to give them a value is returning TRUE instead of what you think it should. HTH Teamatomic Link to comment https://forums.phpfreaks.com/topic/193119-custom-function-not-creating-a-table-correctly/#findComment-1017008 Share on other sites More sharing options...
Glenugie Posted February 23, 2010 Author Share Posted February 23, 2010 Okay problem solved, I wasn't paying enough attention to the *other* variables I was passing in, thanks anyway for the replies Link to comment https://forums.phpfreaks.com/topic/193119-custom-function-not-creating-a-table-correctly/#findComment-1017014 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.