• Greg Marshall

    (@timeassistant)


    Hello,

    I’m trying to read data from a custom single.php template.

    I have my array of data (entries from a form attached to the post ID) I can displays the serialised data on the page and it appears correct however when I try to select the file path it gives me

    
    ERROR
    Table in data source has no rows.

    I think this is because the file can only pull the ID when the single.php is loaded, is there a way to make this work?

    use case: I am using a forms plugin which has an inferior entry viewer, it doesnt work on the front end as desired. The form is attached to the post type via ACF field (each post has its own form connected through the ACF field which takes the form ID). The code is set to check the current post ID and pull the form ID entered in the ACF field. From there I run a function to gather all the entry data. I then serialised this and echo’d it and the data is shown.

    Can you let me know if there is a way around this? The table is going to be shown on the same single.php template, its more of a dynamic table.

    Thanks

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author wpDataTables

    (@wpdatatables)

    Hi Greg Marshall,

    Can you please tell me did your PHP file returning proper format for serialized array needed for wpdatatables like is explain in our docs on this link?

    The format of the serialized array should be the following: 2D-array, where the parent level is an indexed array, and the second level is an associative array. Parent array entries will be parsed as rows, child array keys will be parsed as column headers, and child array values as cell values.

    Thread Starter Greg Marshall

    (@timeassistant)

    hello thank you for the reply,

    I thought it looked right but looking back I think its actually a 3 level array rather than 2… Do you have a private address I can send the result or some code to? I shouldn’t post the live results here

    If it helps I am using this with Caldera forms to replace their front end entry viewer, I have used their functions to retrieve the data submitted with the form, I believe the actual entry data itself is the 3rd array called ‘formdata’

    Thanks for the quick reply

    Thread Starter Greg Marshall

    (@timeassistant)

    Hello,

    I now have a proper 2d array passed through ‘Serialize()’ but I am still having the same issue.

    I will be glad to provide some code example of what I am doing if it helps to work out the issue.

    Thank you

    Thread Starter Greg Marshall

    (@timeassistant)

    @wpdatatables Can you provide me an email address to send a private message? Your support site seems to want to forward me to 3rd party premium services. I just want support figuring out why the plugin will not read my data.

    Thanks

    Plugin Author wpDataTables

    (@wpdatatables)

    Unfortunately, due to rules of wordpress.org, we cannot provide a link to our official support platform here.

    You can access the platform from our official website and through our documentation (linked above), by going through Support/scroll down -> Submit a ticket. Tickets are not hosted on our website, but please feel free to submit a ticket there.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Unable to read data from a single.php template’ is closed to new replies.