Deleting Unwanted Entries
Can you honestly say that I've ever lied to you? Did I not mention in my last article that we would revisit the "delete from MyInformIT" functionality? Lines 5460 create the proper links to perform that task. The function myinformit/addto/index.asp is called, this time with a command=delete argument on the query string. If you mouse over a delete link on the MyInformIT page, you'll see just what's built above. addto/index.asp handles the delete, keying on the provided product_id and/or element_id.
61 <tr valign="top"> 62 <td colspan="3"> 63 <img src="<%=lpath%>images/basics/dot.gif" width="8" height="5"></td> 64 </tr> 65 <tr valign="top"> 66 <td> 67 <font size="-2"> 68 <b> 69 <a href="<%=product_url%>" class="redorange"><%=prod_name%></a> 70 </b> 71 </font> 72 </td> 73 <td align="right" width="10"> </td> 74 <td align="right"> 75 <font size="-2"> 76 [<a href="<%=delete_url%>">Delete</a>] 77 </font> 78 </td> 79 </tr> 80 81 <%l_dsProducts.MoveNext() %> 82 <% Next %>
...we draw the row in HTML. You can see on line 69 where our predetermined variables, product_url and prod_name, are inserted. On line 76, delete_url is similarly ensconced. All that's left is to move to the next record in the recordset on line 81, and to slide to the top of the FOR loop on line 82.
Whew! That was a lot of code to wade through. I hope that you stuck around and found the journey worth the time. It's always educational for me to look at code that other InformIT developer drones have written. There's inevitably a new slant or different way of doing things that I hadn't thought of before.
In the next installment, I'll discuss the other half of the MyInformIT page: the personalized InformIT Recommends section. It should be a hoot...unless, of course, it's a Monday.