Can I use a php file to enter variables and echo them in the html page? -
i coding 1 page lander know's little code. thinking of making user friendly on parts require customization, things <title></title>
, headlines on website, urls in another php file.
my idea make main file, lets call main_file.php
make easy.
in main_file.php
want have: (for example)
$title = "web page title here"; $headline = "headline here" $url1 = "http://a custom url here.com"; etc
and have above echo
'd in right files.
the goal of being user coding for, have edit 1 clear file, instructions etc needed.
just that.
your configuration file main_file.php
right?
your-application/main_file.php
then, have master layout/template example:
your-application/index.php
in layout can include main file in first line:
<?php include ('main_file.php'); ?> <!-- rest of code below --> <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title><?php echo $title ?></title> </head> <body> <h1><?php echo $page_tile ?></h1> <p><?php echo $some_text_variable ?></p> </body> </html>
done!
all variables declared in main_file.php
available in index.php
.
- the template/layout file must php file, can put html inside, understood?
Comments
Post a Comment