This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > Dreamweaver > August 2005 > Repeating Table Row DIV ID Calculations





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Repeating Table Row DIV ID Calculations
checkersam

2005-08-11, 7:22 pm

Is there a way to make Dreamweaver calculate an increasing number for each row
added to a repeating region?

I have a project with pages for multiple products which I'm adding unique DIV
ID attributes for later database integration. I want Dreamweaver to calculate
an increasing number value everytime a new row is added so that I don't have to
manually change the IDs in the many table cells per row whenever a new row is
added.

For example, my ID attribute in the DIV tag looks like this:

<div id="ProductDescription-Row1">

When I added a row via the Dreamweaver Repeating Region feature, I want that
ID attribute in the new row to automatically result in:

<div id="ProductDescription-Row2">

Additionally, a third row would result in <div id="ProductDescription-Row3">,
and so on.


I found the code for getting repeating rows to alternate colors:

<tr bgcolor="@@(_index & 1) ? '#FFFFFF' : '#CCCCCC' @@">

Is there a way to add code similar to the above into my ID attribute for
calculating an increasing number like so:

<div id="ProductDescription-Row@@(_index & 1) ? code that adds increasing
values@@">

Thanks for any help!

Murray *TMM*

2005-08-11, 7:22 pm

Sure is. Just add -

@@(_index)@@ to your id text, e.g.,

<div id=''ProductDescription-Row@@(_index)@@''>

and it will increment with your repeat number.


--
Murray --- ICQ 71997575
Team Macromedia Volunteer for Dreamweaver
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================

"checkersam" <webforumsuser@macromedia.com> wrote in message
news:ddg8ee$q5b$1@forums.macromedia.com...
> Is there a way to make Dreamweaver calculate an increasing number for each
> row
> added to a repeating region?
>
> I have a project with pages for multiple products which I'm adding unique
> DIV
> ID attributes for later database integration. I want Dreamweaver to
> calculate
> an increasing number value everytime a new row is added so that I don't
> have to
> manually change the IDs in the many table cells per row whenever a new row
> is
> added.
>
> For example, my ID attribute in the DIV tag looks like this:
>
> <div id="ProductDescription-Row1">
>
> When I added a row via the Dreamweaver Repeating Region feature, I want
> that
> ID attribute in the new row to automatically result in:
>
> <div id="ProductDescription-Row2">
>
> Additionally, a third row would result in <div
> id="ProductDescription-Row3">,
> and so on.
>
>
> I found the code for getting repeating rows to alternate colors:
>
> <tr bgcolor="@@(_index & 1) ? '#FFFFFF' : '#CCCCCC' @@">
>
> Is there a way to add code similar to the above into my ID attribute for
> calculating an increasing number like so:
>
> <div id="ProductDescription-Row@@(_index & 1) ? code that adds increasing
> values@@">
>
> Thanks for any help!
>



checkersam

2005-08-11, 7:22 pm

This seems great and thank you(!), but I'm afraid it will never work for me
because the <div id="...> tags are within editable regions that are within an
overall Repeating Region.

When I tried to add your nifty incremental number code ("@@(_index)@@") to my
ID attribute, I got a error dialogue that claimed I could not add "directive
code" to an editable region.

In other words, I do have a Repeating Region, but that's not the table nesting
level at which I want to add the directive code. It's a nested level down
within editable regions that contain tables with multiple cells that hold the
DIV tags where I want the increasing numbers to appear. Whew, that sounds
confusing. See below for template code that shows the Repeating Region and it's
nest editable region tables.

I think I'm at an impasse. My needs appear too complicated for the
implementation of the directive code feature (or more likely I've unnecessarily
complicated my code :-} ...though I can't figure an easier way to use the
Repeating Regions with my multi-faceted product description needs).

Any other ideas are of course highly appreciated.

</tr>
<!-- TemplateBeginRepeat name="RepeatingProductsRow" -->
<tr>
<td width="233" style="padding:15px 15px 0px 0px; " valign="top" ><!--
TemplateBeginEditable name="LeftColumnCell" -->
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="3" height="125" align="center"><div
id="ProductImage-Row1A"><a href=""
onClick="NewWindow(this.href,'name','366','385','no');return false;"><img
src="images/magnifier.gif" width="25" height="20" border="0"
align="bottom"></a></div></td>
</tr>
<tr>
<td colspan="3" style="padding-top:6px; "><div
class="ProductDescriptionText" id="ProductDescription-Row1A-Row1"></div></td>
</tr>
<tr>
<td valign="top" width="33%" style="padding-top:5px; "><div
class="ProductTypeText" id="ProductType-Row1A-Col1Row1"></div></td>
<td valign="top" align="center" width="33%" style="padding-top:5px; "><div
class="ProductPriceText" id="ProductPrice-Row1A-Col2Row1"></div></td>
<td valign="top" width="33%" style="padding-top:5px; "><div
class="ProductIDText" id="ProductID-Row1A-Col3Row1"></div></td>
</tr>
</table>
<!-- TemplateEndEditable --></td>
<td width="233" style="padding:15px 15px 0px 0px; " valign="top"><!--
TemplateBeginEditable name="MiddleColumnCell" -->
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="3" height="125" align="center"><div
id="ProductImage-Row1B"><a href=""
onClick="NewWindow(this.href,'name','366','385','no');return false;"><img
src="images/magnifier.gif" width="25" height="20" border="0"
align="bottom"></a></div></td>
</tr>
<tr>
<td colspan="3" style="padding-top:6px; "><div
class="ProductDescriptionText" id="ProductDescription-Row1B-Row1"></div></td>
</tr>
<tr>
<td valign="top" width="33%" style="padding-top:5px; "><div
class="ProductTypeText" id="ProductType-Row1B-Col1Row1"></div></td>
<td valign="top" align="center" width="33%" style="padding-top:5px; "><div
class="ProductPriceText" id="ProductPrice-Row1B-Col2Row1"></div></td>
<td valign="top" width="33%" style="padding-top:5px; "><div
class="ProductIDText" id="ProductID-Row1B-Col3Row1"></div></td>
</tr>
</table>
<!-- TemplateEndEditable --></td>
<td width="234" style="padding:15px 0px 0px 0px; " valign="top"><!--
TemplateBeginEditable name="RightColumnCell" -->
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="3" height="125" align="center"><div
id="ProductImage-Row1C"><a href=""
onClick="NewWindow(this.href,'name','366','385','no');return false;"><img
src="images/magnifier.gif" width="25" height="20" border="0"
align="bottom"></a></div></td>
</tr>
<tr>
<td colspan="3" style="padding-top:6px; "><div
class="ProductDescriptionText" id="ProductDescription-Row1C-Row1"></div></td>
</tr>
<tr>
<td valign="top" width="33%" style="padding-top:5px; "><div
class="ProductTypeText" id="ProductType-Row1C-Col1Row1"></div></td>
<td valign="top" align="center" width="33%" style="padding-top:5px; "><div
class="ProductPriceText" id="ProductPrice-Row1C-Col2Row1"></div></td>
<td valign="top" width="33%" style="padding-top:5px; "><div
class="ProductIDText" id="ProductID-Row1C-Col3Row1"></div></td>
</tr>
</table>
<!-- TemplateEndEditable --></td>
</tr>
<!-- TemplateEndRepeat -->

Murray *TMM*

2005-08-11, 11:22 pm

Ahh - you're right. I need to dig into my archives.....

Be back later.

--
Murray --- ICQ 71997575
Team Macromedia Volunteer for Dreamweaver
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================

"checkersam" <webforumsuser@macromedia.com> wrote in message
news:ddghp8$afe$1@forums.macromedia.com...
> This seems great and thank you(!), but I'm afraid it will never work for
> me
> because the <div id="...> tags are within editable regions that are within
> an
> overall Repeating Region.
>
> When I tried to add your nifty incremental number code ("@@(_index)@@") to
> my
> ID attribute, I got a error dialogue that claimed I could not add
> "directive
> code" to an editable region.
>
> In other words, I do have a Repeating Region, but that's not the table
> nesting
> level at which I want to add the directive code. It's a nested level down
> within editable regions that contain tables with multiple cells that hold
> the
> DIV tags where I want the increasing numbers to appear. Whew, that sounds
> confusing. See below for template code that shows the Repeating Region and
> it's
> nest editable region tables.
>
> I think I'm at an impasse. My needs appear too complicated for the
> implementation of the directive code feature (or more likely I've
> unnecessarily
> complicated my code :-} ...though I can't figure an easier way to use the
> Repeating Regions with my multi-faceted product description needs).
>
> Any other ideas are of course highly appreciated.
>
> </tr>
> <!-- TemplateBeginRepeat name="RepeatingProductsRow" -->
> <tr>
> <td width="233" style="padding:15px 15px 0px 0px; " valign="top" ><!--
> TemplateBeginEditable name="LeftColumnCell" -->
> <table width="100%" border="0" cellspacing="0" cellpadding="0">
> <tr>
> <td colspan="3" height="125" align="center"><div
> id="ProductImage-Row1A"><a href=""
> onClick="NewWindow(this.href,'name','366','385','no');return false;"><img
> src="images/magnifier.gif" width="25" height="20" border="0"
> align="bottom"></a></div></td>
> </tr>
> <tr>
> <td colspan="3" style="padding-top:6px; "><div
> class="ProductDescriptionText"
> id="ProductDescription-Row1A-Row1"></div></td>
> </tr>
> <tr>
> <td valign="top" width="33%" style="padding-top:5px; "><div
> class="ProductTypeText" id="ProductType-Row1A-Col1Row1"></div></td>
> <td valign="top" align="center" width="33%" style="padding-top:5px;
> "><div
> class="ProductPriceText" id="ProductPrice-Row1A-Col2Row1"></div></td>
> <td valign="top" width="33%" style="padding-top:5px; "><div
> class="ProductIDText" id="ProductID-Row1A-Col3Row1"></div></td>
> </tr>
> </table>
> <!-- TemplateEndEditable --></td>
> <td width="233" style="padding:15px 15px 0px 0px; " valign="top"><!--
> TemplateBeginEditable name="MiddleColumnCell" -->
> <table width="100%" border="0" cellspacing="0" cellpadding="0">
> <tr>
> <td colspan="3" height="125" align="center"><div
> id="ProductImage-Row1B"><a href=""
> onClick="NewWindow(this.href,'name','366','385','no');return false;"><img
> src="images/magnifier.gif" width="25" height="20" border="0"
> align="bottom"></a></div></td>
> </tr>
> <tr>
> <td colspan="3" style="padding-top:6px; "><div
> class="ProductDescriptionText"
> id="ProductDescription-Row1B-Row1"></div></td>
> </tr>
> <tr>
> <td valign="top" width="33%" style="padding-top:5px; "><div
> class="ProductTypeText" id="ProductType-Row1B-Col1Row1"></div></td>
> <td valign="top" align="center" width="33%" style="padding-top:5px;
> "><div
> class="ProductPriceText" id="ProductPrice-Row1B-Col2Row1"></div></td>
> <td valign="top" width="33%" style="padding-top:5px; "><div
> class="ProductIDText" id="ProductID-Row1B-Col3Row1"></div></td>
> </tr>
> </table>
> <!-- TemplateEndEditable --></td>
> <td width="234" style="padding:15px 0px 0px 0px; " valign="top"><!--
> TemplateBeginEditable name="RightColumnCell" -->
> <table width="100%" border="0" cellspacing="0" cellpadding="0">
> <tr>
> <td colspan="3" height="125" align="center"><div
> id="ProductImage-Row1C"><a href=""
> onClick="NewWindow(this.href,'name','366','385','no');return false;"><img
> src="images/magnifier.gif" width="25" height="20" border="0"
> align="bottom"></a></div></td>
> </tr>
> <tr>
> <td colspan="3" style="padding-top:6px; "><div
> class="ProductDescriptionText"
> id="ProductDescription-Row1C-Row1"></div></td>
> </tr>
> <tr>
> <td valign="top" width="33%" style="padding-top:5px; "><div
> class="ProductTypeText" id="ProductType-Row1C-Col1Row1"></div></td>
> <td valign="top" align="center" width="33%" style="padding-top:5px;
> "><div
> class="ProductPriceText" id="ProductPrice-Row1C-Col2Row1"></div></td>
> <td valign="top" width="33%" style="padding-top:5px; "><div
> class="ProductIDText" id="ProductID-Row1C-Col3Row1"></div></td>
> </tr>
> </table>
> <!-- TemplateEndEditable --></td>
> </tr>
> <!-- TemplateEndRepeat -->
>



Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews