0

Does anyone here know of a generator that can automatically create tables for you? Basically, I have a site with over 100 pdf files in it, and I want to put them in a table so that they display in a list. Is there a generator that can create the table for me without me having to create each individual link to each pdf?

I don't know if that makes sense or not.

3
Contributors
3
Replies
18
Views
2 Years
Discussion Span
Last Post by JorgeM
1

Retrieve the list of pdfs from your DB (if stores) or from the folder(s) from a scan/read. There are many functions / techniques for reading directories - glob, SPL functions, even scandir (yuk!).

You can then loop over this list and create a row for each one, adding to a string each time via concatenation.

$str = "<table><thead><tr><th>PDFS</th></thead<tbody>";
foreach($files as $file) $str .= "<tr><td>$file</td></tr>"; 
$str .= "</tbody></table>";
echo $str;

That's a basic technique which you can pad out to create the format and number of fields that you need. I'm sure there are many ready made scripts out there, but this is so simple, I don't see the need. Were you looking for sommething more complicated?

Votes + Comments
This is what I would go with. I like simple solutions!
0

Were you looking for sommething more complicated?

I was wondering if there was an actual generator already made that can do it. But i can try toying around with that.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.