• Resolved humanplus

    (@humanplus)


    Hello,

    I created a table – now it’s small – and I have URLs with .txt file which should be shown in the right cells.

    A B C D E F
    1
    2
    3
    4
    5

    For example :
    A1 –> url.com/firstcell.txt
    A2 –> url.com/secondcell.txt

    The text inside that txt file should be shown (echo) in the cells.

    The only way, I’m new to TablePress, I know, was to do it with PHP :

    <?php $content = file_get_contents("https://url.com/dir/dir/textfile.txt"); echo $content; ?>

    ### I have 2 Problems :

    1) If I use formulas to ad them together TablePress says that there are no numbers. But in the table on my website i can see them.

    2) I see, that loading this page with the Table, with a lot of PHP file_get_contents, loads really slow.
    Is there anohter way to show the content of the .txt files than PHP?

    Thank you very much in advance.

    HP

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi,

    thanks for your post, and sorry for the trouble.

    If you really need to load all those URLs from other servers, this will always be very slow, unless you can add some sort of server caching (that is, only load the files every our or something like that).

    The formulas will not work here, because they are applied before the PHP code is run. That’s why the formulas don’t see the numbers, but your PHP code.

    I would therefore recommend to write a custom PHP script first, that does all the data retrieval. The output of that script could then be your table in CSV format, which you could import into TablePress periodically.

    Regards,
    Tobias

    Thread Starter humanplus

    (@humanplus)

    Hi Tobias,

    thank you very much for your quick answer.

    These files are stats files with separate data, every file has numbers in it. So in this case I will have to try to create a CSV formated file with this data (in BASH).

    A little adventure. But I think I will see what to do, if I export a table – this shuld be the syntax.

    I thought that there’s a possibiity with java to show the content from the files?

    Best regards,
    HP

    Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi,

    yes, preformatting the desired data as a CSV file will be the best here. You could use Bash of course or PHP as well.

    Unfortunately, there’s not direct way to show the files using JavaScript, sorry.

    Regards,
    Tobias

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘TablePress Table and Cells with external data’ is closed to new replies.