Gossamer Forum
Home : Products : Links 2.0 : Customization :

Need Help With simple table mod.

Quote Reply
Need Help With simple table mod.
I'm trying to re-format the output from links to fit in a little better in a site I am building. Here is the code for how I want each category list and links list to be outputted. (here are two links to show how it should repeat) I would appreciate it if someone could help me out in figuing out where to edit Links 2 so I can do this, especially with the page spanning.

Code:
<table width="500" border="0" cellspacing="2" cellpadding="2" bordercolor="0" class="linkmenu">
<tr bgcolor="#CCCCCC">
<td width="100%" colspan="2"><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b>Link
or category name</b></font></td>
</tr>
<tr>
<td width="6%"> </td>
<td width="94%" bgcolor="#EFEFEF"> <span class="descript"> Description
hot cool etc</span></td>
</tr>
<tr bgcolor="#CCCCCC">
<td width="100%" colspan="2"><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b>Link
or category name</b></font></td>
</tr>
<tr>
<td width="6%"> </td>
<td width="94%" bgcolor="#EFEFEF"> Description hot cool etc</td>
</tr>
</table>

thanks, James

[This message has been edited by the wddg (edited February 18, 1999).]
Quote Reply
Re: Need Help With simple table mod. In reply to
Are you using the templates? I've found them a lot easier to modify when using tables for page layout (if you do this, be sure to remove all of the positioning elements from the CSS file or they will position from your table border, not the browser window).

For the link output, you will have to edit two files: category.html (for the page layout) and link.html (for the link appearance). You don't have to worry about the page spanning...the program just creates a whole new page when it needs one.

Here's a snippit from my category.html file that you may find useful (notice that I have put this all in one <TD> tag...my other <TD> is simply used to create a left hand column, so its not very helpful):

Code:
<TD WIDTH="540" VALIGN="TOP"> <BR>
<FONT COLOR="#FFFF33" FACE="arial, helvetica, sans-serif" SIZE="2">
<!-- menu bar -->
<P><strong class="title"><%title_linked%></strong></P>


<!-- Subcategories-->
<%if category%>
<H3>Categories:</H3>
<%category%>
<%endif%>


<!-- Links in this category. -->
<%if links%>
<H3>Links: </H3>
<%links%>
<%endif%>

<!-- Next/Previous links if spanning pages. -->
<p align="center">
<%if prev%>
<small><a href="<%prev%>">Prev <%build_links_per_page%></a> </small>
<%endif%>
<%if next%>
<small><a href="<%next%>">Next <%build_links_per_page%></a></small>
<%endif%>
</p>


<!-- Related Categories -->
<%if related%>
<H3>Related Categories:</H3>
<ul><%related%></ul>
<%endif%>
</FONT>
<BR></TD>

From what I've gathered in this forum, it's important to give the <%if%> and <%endif%> statements their own line, but the <%related%> and similar variables can be mixed with anything you want (a CGI guru can probably verify why this is).

For the links themselves, just edit links.html to match whatever output you want. This file represents ONE link, and the ENTIRE file is inserted where you see the <%links%> statement above for EACH link. In other words, you need to make link.html a fully closed tag regardless of what it is. The default tag is <UL>, but you can make it a table, a <DL> list, or whatever. Don't try to make a <TR> or <TD> tag all by itself, make it a FULL table. By examining the default <UL> tag, you should be able to figure out where to put the program variables. Again, you should let the <%if%> statements have their own line, but can format around the other ones. For example:
Code:
<tr>
<td width="6%"> </td>
<td bgcolor="#EFEFEF"><span class="descript"><FONT SIZE="2"><%Description%></FONT></span></td>
</tr>

Unfortunately, the only way to really verify how the links will look is to edit the file, add a couple of links to the same category, build the pages, then check it out. Tinker with it until you see what you want!

One final item of note: I would definitely avoid assigning ANY class attributes to the <TABLE> tag (i.e. class="linkmenu" in the code you provided). IE seems OK with it, but Netscape has crashed on me when doing so. Instead, enclose the entire table in a <DIV> statement, apply the class to the <TD> tags, or to a <DIV> or <SPAN> tag within <TD>. It's hard to say which is better without knowing what your linkmenu class does.

Hope this helps!

[This message has been edited by Brad Richardson (edited February 20, 1999).]