QUESTION external text file - Printable Version +- GetSimple Support Forum (http://get-simple.info/forums) +-- Forum: GetSimple (http://get-simple.info/forums/forumdisplay.php?fid=3) +--- Forum: General Questions and Problems (http://get-simple.info/forums/forumdisplay.php?fid=16) +--- Thread: QUESTION external text file (/showthread.php?tid=8398) |
external text file - bmdt - 2016-05-06 Hello, can i achieve this in GetSimpleCMS? I have a temperature sensor wich puts it's last measure in a text file Can i read this value from the text file and show it on the website? Can anyone let me know if it's possible, and how to achieve this? Thanks Ben RE: external text file - Bigin - 2016-05-06 You could add something like this in your template.php file: Code: $file = '/path/to/your/file.txt'; RE: external text file - jwzumwalt - 2016-05-07 A complete example would be... PHP Code: <?php RE: external text file - Bigin - 2016-05-07 Infinite loops are not really a good practice server-side, you should try to avoid the while(true) idiom whenever it possible. PHP is not suitable for real time applications, Ajax call more suitable for this purpose. RE: external text file - shawn_a - 2016-05-07 Yeah a meta refresh is just as easy if you want a live display, ideally use js or sockets, infinite flush will tie up a socket and everntually probably crash RE: external text file - jwzumwalt - 2016-05-08 (2016-05-07, 03:12:01)Bigin Wrote: Infinite loops are not really a good practice server-side, you should try to avoid the while(true) idiom whenever it possible. PHP is not suitable for real time applications, Ajax call more suitable for this purpose. OK... so how about an example for comparison? RE: external text file - shawn_a - 2016-05-08 Well the poster didn't ask for a real time display, just to read a file |