DOM Processing *after* PHP execution within HTML

DOM Processing *after* PHP execution within HTML

BeachMickBeachMick Posts: 9Questions: 2Answers: 0

Link: http://beachcarolina.com/tickets/examples/data_sources/dom.php

DataTables debugger: http://debug.datatables.net/ekafam

I am attempting to place the results from a PHP function (via PHP print_r OR echo command) within the HTML table based on the HTML (DOM) example at http://datatables.net/examples/data_sources/dom.html.

The table data seems to be printing out correctly as reviewed via page source AND the headers seem to be displaying to include the underline of the headers row. The rest of the datatables functionality does not seem to be working correctly.

I would LOVE to learn a means of making this work correctly while:
1) keeping the PHP function available to print out the HTML table, and
2) have the datatables functionality work similar to that in your HTML (DOM) example.

To further explain, I would love to keep this "dynamic data" table in a fashion that search engines would find that content on the page as I plan to have a "default" load of the PHP function to begin.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,442Questions: 1Answers: 10,053 Site admin
    edited May 2014 Answer ✓

    That should all be fine. Have your PHP output the HTML table as you need, and then run DataTables on it. It is a sequential operation and DataTables doesn't really case where the data comes from.

    It isn't working on your sample page because your HTML is invalid. Your tbody td cells don't have closing tags. For example:

    <td>Bayou Country Superfest<td>
    

    Should be:

    <td>Bayou Country Superfest</td>
    

    Allan

  • BeachMickBeachMick Posts: 9Questions: 2Answers: 0

    Always something simple!
    Thanks for a great product AND for finding my error!

This discussion has been closed.