Streaming live at 10am (PST)

How to display contents of text file


#1

I would like to display the text that’s contained in a small text file on a web page. It’s just basically an app’s version number and I don’t want to have to update the entire site when just the version number changes.

I tried adding this as an embed code but nothing gets displayed: (when exported, I know it won’t display in preview)

<?php
echo file_get_contents( "http://mysite/downloads/currentVersion.txt" ); 
?>

Anyone? Thanks!


#2

You cannot use PHP in Webflow.

How to embed files hosted on Github


#3

Thank you. That worked perfectly.

For those looking for the simple answer, here’s the code (just replace the link):

<div id="ajaxContent"></div>
<script>
  var Webflow = Webflow || [];
  Webflow.push(function() {
    $.get('http://www.mySite.com/downloads/currentVersion.txt', function(data) {
      $('#ajaxContent').append(data);
    });
  });
</script>

#4

This topic was automatically closed after 60 days. New replies are no longer allowed.