Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Other Pass local variables to included php file/template Reply To: Pass local variables to included php file/template

#255951
Beverleyh
Participant

You need to pass a parameter. Google “PHP function parameter” for more info, but in brief;

about.php

<?php
$title = "This is About page";
include("links.php");
?>
<html>
<head>
<?php echo meta_links($title); ?>

links.php

<?php
function meta_links($my_title) {
    return $my_title;
}
?>