How to partial refresh a include php page?

yuli chika picture yuli chika · Jan 22, 2011 · Viewed 24.3k times · Source
<?php include("news.php"); ?>

Hello, I include a news.php in my main page index.php. I want to refresh the news.php every 30 seconds, but not refresh the main page index.php, How to partial refresh a include php page? Thanks.

Answer

Carles Bataller picture Carles Bataller · Jul 19, 2021

Another way to refresh an include (Valid only if the include only contains variables and their values):

<?php
$config = file_get_contents("news.php");
$config = str_replace("<?php", "", $config);
$config = str_replace("?>", "", $config);
eval($config);
?>