Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Snitz Forums 2000 MOD-Group
 MOD Add-On Forum (W/O Code)
 Help with code - rounded tables
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

TastyNutz
Junior Member

USA
251 Posts

Posted - 24 August 2007 :  20:45:53  Show Profile  Visit TastyNutz's Homepage  Reply with Quote
I'm experimenting with adding rounded tables to my site. Rather than trying to change the existing tables, I have created functions to start and stop a table with rounded corners. I then use these functions to "wrap" my existing tables with a thin, rounded border.


<%
'##############################################
'## Rounded Tables MOD ##
'##############################################

function StartRndTables(byval Width)
If strSiteRoundedCorners = "1" then
%>
<table width=<%=Width%> border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="16"><img src="images/top_lef.gif" width="16" height="16"></td>
<td height="16" background="images/top_mid.gif"><img src="images/top_mid.gif" width="16" height="16"></td>
<td width="20"><img src="images/top_rig.gif" width="20" height="16"></td>
</tr>
<tr>
<td width="14" background="images/cen_lef.gif"><img src="images/cen_lef.gif" width="14" height="11"></td>
<td >
<%
end if
end function

function EndRndTables
If strSiteRoundedCorners = "1" then
%>
<td width="20" background="images/cen_rig.gif"><img src="images/cen_rig.gif" width="20" height="11"></td>
</tr>
<tr>
<td width="16" height="16"><img src="images/bot_lef.gif" width="16" height="16"></td>
<td height="16" background="images/bot_mid.gif"><img src="images/bot_mid.gif" width="16" height="16"></td>
<td width="20" height="16"><img src="images/bot_rig.gif" width="20" height="16"></td>
</tr>
</table>
<%
end if
End function
%>

You can see how that looks HERE.

I'm pleased with the effect, but my site has additional "themes" and although the rounded table images have transparency, they don't look good on darker backgrounds. So, I want to pull different images depending on the theme. Seems like it should be simple... use "getCurrentIcon" to display the images that correspond to the selected theme. It SHOULD be simple, but I can't get it right.

I can pull the images, but my problem is getting the top/bottom and side images to become the cell background so that it "tiles" and fills the cell, however large the table is.

The functions below are my attempt to rewrite using ASP, but of course "background" doesn't work here. Can someone help me get this right?


<%
'##############################################
'## Rounded Tables MOD ##
'##############################################

function StartRndTables(byval Width)
If strSiteRoundedCorners = "1" then

Response.write "<table width="""& Width &""" border=""0"" align=""center"" cellpadding=""0"" cellspacing=""0"">" & vbnewline & _
"<tr>" & vbnewline & _
"<td width=""16"">" & getCurrentIcon(strTopLeft,"","") & "</td>" & vbnewline & _
"<td height=""16"" background=""" & getCurrentIcon(strTopMid,"","") & getCurrentIcon(strTopMid,"","") & "</td>" & vbnewline & _
"<td width=""20"">" & getCurrentIcon(strTopRight,"","") & "</td>" & vbnewline & _
"</tr>" & vbnewline & _
"<tr>" & vbnewline & _
"<td width=""14"" background=""" & getCurrentIcon(strCenLeft,"","") & getCurrentIcon(strCenLeft,"","") & "</td>" & vbnewline & _
"<td>" & vbnewline

end if
end function

function EndRndTables
If strSiteRoundedCorners = "1" then

Response.write "<td width=""20"" background=""" & getCurrentIcon(strCenRight,"","") & getCurrentIcon(strCenRight,"","") & "</td>" & vbnewline & _
"</tr>" & vbnewline & _
"<tr>" & vbnewline & _
"<td width=""16"" height=""16"">" & getCurrentIcon(strBotLeft,"","align=""absmiddle""") & "</td>" & vbnewline & _
"<td height=""16"" background=""" & getCurrentIcon(strBotMid,"","") & getCurrentIcon(strBotMid,"","") & "</td>" & vbnewline & _
"<td width=""20"" height=""16"">" & getCurrentIcon(strBotRight,"","align=""absmiddle""") & "</td>" & vbnewline & _
"</tr>" & vbnewline & _
"</table>" & vbnewline

end if
End function
%>
<


PowerQuad Disability Support Forum

MaD2ko0l
Senior Member

United Kingdom
1053 Posts

Posted - 24 August 2007 :  21:01:50  Show Profile  Visit MaD2ko0l's Homepage  Reply with Quote
hiya
shouldnt the background properties be like this(added the bitz in red)


"<td width=""14"" background=""" & getCurrentIcon(strCenLeft,"","") & ">" & getCurrentIcon(strCenLeft,"","") & "</td>" & vbnewline & _


it seems like u r calling the images twice with out closing the starting <td> tag so when viewing it as normal html (ie right click > view source) it woudl look somthign liek this


<td height="16" background="images/bot_mid.gif"<img src="images/bot_mid.gif" width="16" height="16"></td>




hey wait...just looked at the inc_iconfiles.asp file and u wont be able to use the getCurrentIcon function to display the image because it add the whole img tags (eg. <img src="filename.gif">) rather than just the file name

<

© 1999-2010 MaD2ko0l
Go to Top of Page

TastyNutz
Junior Member

USA
251 Posts

Posted - 25 August 2007 :  01:10:10  Show Profile  Visit TastyNutz's Homepage  Reply with Quote
Thank you. I got it working, thanks to your clue. Sometimes I need someone to remind me of the obvious. That's why I come here.

The functions:

<%
'##############################################
'## Rounded Tables MOD ##
' by TastyNutz@powerquad.net
'##############################################

function StartRndTables(byval Width)
If strSiteRoundedCorners = "1" then

Response.write "<table width="""& Width &""" border=""0"" align=""center"" cellpadding=""0"" cellspacing=""0"">" & vbnewline & _
"<tr>" & vbnewline & _
"<td width=""1"">" & getCurrentIcon(strTopLeft,"","") & "</td>" & vbnewline & _
"<td height=""1"" """ & strTopMidBG & """></td>" & vbnewline & _
"<td width=""1"">" & getCurrentIcon(strTopRight,"","") & "</td>" & vbnewline & _
"</tr>" & vbnewline & _
"<tr>" & vbnewline & _
"<td width=""1"" """ & strCenLeftBG & """></td>" & vbnewline & _
"<td>" & vbnewline

end if
end function


function EndRndTables
If strSiteRoundedCorners = "1" then

Response.write "<td width=""1"" """ & strCenRightBG & """></td>" & vbnewline & _
"</tr>" & vbnewline & _
"<tr>" & vbnewline & _
"<td width=""1"" >" & getCurrentIcon(strBotLeft,"","") & "</td>" & vbnewline & _
"<td height=""1"" """ & strBotMidBG & """></td>" & vbnewline & _
"<td width=""1"" >" & getCurrentIcon(strBotRight,"","") & "</td>" & vbnewline & _
"</tr>" & vbnewline & _
"</table>" & vbnewline

end if
End function
%>


And to each of my theme files I add:


'##############################################
'## Rounded Tables MOD ##
strBotLeft = "themes/hi_tech/bot_lef.gif||"
strBotRight = "themes/hi_tech/bot_rig.gif||"
strBotMid = "themes/hi_tech/bot_mid.gif"
strCenLeft = "themes/hi_tech/cen_lef.gif"
strCenRight = "themes/hi_tech/cen_rig.gif"
strTopLeft = "themes/hi_tech/top_lef.gif||"
strTopRight = "themes/hi_tech/top_rig.gif||"
strTopMid = "themes/hi_tech/top_mid.gif"
strCenLeftBG = " background=""" & strImageURL & strCenLeft
strTopMidBG = " background=""" & strImageURL & strTopMid
strBotMidBG = " background=""" & strImageURL & strBotMid
strCenRightBG = " background=""" & strImageURL & strCenRight
'##############################################


Now I'm going to sleep. Tomorrow I'll create some new images.<


PowerQuad Disability Support Forum
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.1 seconds. Powered By: Snitz Forums 2000 Version 3.4.07