the PHP doesn't have to be that obtrusive, with endless echo and print
statements. Turn your data into a two dimensional array $rows:


<table>
<? foreach($rows as $row) : ?>
<tr>
    <? foreach ($row as $cell) : ?>
    <td><?= $cell ?></td>
    <? endforeach; ?>
</tr>
<? endforeach ?>
</table>


On Tue, Mar 4, 2008 at 10:20 AM, charlie <[EMAIL PROTECTED]> wrote:

>
> Hi all, the application I'm attempting to write couldn't be simpler:
> I want to display rows of data, retrieved from a database and allow
> people to edit or delete those rows and add new rows.  Backend is PHP,
> but I'd prefer to keep that out of the picture.  So far I'm passing my
> rows successfully to jquery and have the loop ready to go, but I'm not
> sure how to proceed.
>
> Here's my dilemma:  what's the best strategy for keeping the HTML out
> of my Javascript as much as possible?  The whole point of this
> excercise has been to try to extricate as much PHP as possible from
> the display logic, but just subbing in javascript is obviously pretty
> pointless.
>
> One strategy I'm toying with is having an HTML "empty row" in the
> normal layout that's hidden and get's cloned for both existing and new
> records.  Is this a common technique?  Are there better ones?  I'm
> trying not to re-invent the wheel here!
>
> TIA, Charles
>

Reply via email to