Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Repeating region hyperlinks

Status
Not open for further replies.

cardiac

Technical User
Feb 19, 2004
31
0
0
GB
I have created a web page that consists of a repeating region from a database. The resulting table gives the details of a server stored document. The columns are: the date the document was stored,the document title, and a final 3rd column.
I want this 3rd column to contain an icon of either a pdf, word, excel, etc,that denotes the document type. This icon should than be able to open the relevant document from the server when pressed.

How do I generate this 3rd column dynamically?

I would appreciate any help - thanks.
 
If you use explode() on the file name you can get the extension. Use an array of extensions with corresponding icon filenames as a lookup, and use that icon as an image <href> element that points to the file.

If you want the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
 
Thanks - I managed to get it working with the following code:

<?php do { ?>
<table width="612" border="1" align="center">
<?php $news_link="docs/".$row_rsNews['doc_name']; ?>
<tr>
<td width="95" align="center"><?php echo $row_rsNews['date']; ?></td>
<td width="260" align="center"><?php echo $row_rsNews['title']; ?></td>
<td width="131" align="center"><?php echo $row_rsNews['news_type']; ?></td>
<td width="108" align="center"><?php echo "<a href='".$news_link."'><img src='images/pdf.gif' width='17' height='17' style='border-style: none'/></a>";?></td>
</tr>
</table>
<?php } while ($row_rsNews = mysql_fetch_assoc($rsNews)); ?>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top