unique id required when sorting records on list page
3 posts by 2 authors in: Forums > CMS Builder
Last Post: August 31, 2009 (RSS)
By Deborah - August 31, 2009
I'm using an expanding panel widget on a multi-record list page viewer that requires each item in the list to display with unique html code.
Example:
<div id="div_1">
<div id="item1_1">
<?php echo $record['project_title'] ?>
<?php echo $record['project_description'] ?>
</div>
</div>
<div id="div_2">
<div id="item2_2">
<?php echo $record['project_title'] ?>
<?php echo $record['project_description'] ?>
</div>
</div>
<div id="div_3">
<div id="item3_3">
<?php echo $record['project_title'] ?>
<?php echo $record['project_description'] ?>
</div>
</div>
Is there a way with PHP to display the top-sorted record in div_1, the second in div_2, etc?
I am using dragSortOrder to order the records.
Thanks for any help!!!
Example:
<div id="div_1">
<div id="item1_1">
<?php echo $record['project_title'] ?>
<?php echo $record['project_description'] ?>
</div>
</div>
<div id="div_2">
<div id="item2_2">
<?php echo $record['project_title'] ?>
<?php echo $record['project_description'] ?>
</div>
</div>
<div id="div_3">
<div id="item3_3">
<?php echo $record['project_title'] ?>
<?php echo $record['project_description'] ?>
</div>
</div>
Is there a way with PHP to display the top-sorted record in div_1, the second in div_2, etc?
I am using dragSortOrder to order the records.
Thanks for any help!!!
Re: [Deborah] unique id required when sorting records on list page
By Kenny - August 31, 2009
A lot of times we can just use the Record Number instead. There may be some other ways to do this, but here's one:
Try this....
<div id="div_<?php echo $record['num'] ?>">
<div id="item1_<?php echo $record['num'] ?>">
<?php echo $record['project_title'] ?>
<?php echo $record['project_description'] ?>
</div>
</div>
Alternatively, you can create a textfield to manually put a number in and use that instead.
Kenny
Try this....
<div id="div_<?php echo $record['num'] ?>">
<div id="item1_<?php echo $record['num'] ?>">
<?php echo $record['project_title'] ?>
<?php echo $record['project_description'] ?>
</div>
</div>
Alternatively, you can create a textfield to manually put a number in and use that instead.
Kenny
Re: [sagentic] unique id required when sorting records on list page
By Deborah - August 31, 2009
Kenny,
Your advice was right on! Great advice!
I thought I needed sequential numbering, but all I needed was unique numbering, as provided with the $record['num'], as you suggested.
Thanks so much for your assistance.
Deborah
Your advice was right on! Great advice!
I thought I needed sequential numbering, but all I needed was unique numbering, as provided with the $record['num'], as you suggested.
Thanks so much for your assistance.
Deborah