add an external md file to a php page

… and, of course see it as html, with the same graphical appearance of any other web text.

A way can be use a very light javascript, md-block.js, di Lea Verou.

Then you can add a function to your php website, like the following:

<?php
/* to call a file Markdown from a given folder */

function scheda_md($file)
{
    global $yourwebsite;

    $file = basename($file);

    return '<md-block src="' .
           $yourwebsite .
           '/the-path/where-are-md-files/from-yourwebsite-root' .
           htmlspecialchars($file, ENT_QUOTES, 'UTF-8') .
           '"></md-block>';
}
?>

And in the page where you want to show that md file you can use this code:

<?= scheda_md('the-md-name.md') ?>



linguaggio PHP includere un file remoto

Il comando “include url/nomedelfileremoto” non è sempre accessibile, ed è comunque dispendioso di risorse.
Ho trovato questo comando

<?php
echo file_get_contents(‘http://exempe.com/filename.php’);
?>

Molto utile, ad esempio per condividere dei links tra diversi siti gestitidallo stesso webmaster.
L’ho visto su questo sito.
Occorre che il server supporti la funzione allow_url_fopen (allow_url_fopen=on).