rwcurry Posted December 7, 2009 Share Posted December 7, 2009 I am creating a site where i have a php template for the page layout and would like to call different "content" include files from a menu. The template looks similar to this. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Test</title> <meta http-equiv="Content-Type" content="text/html;charset=utf-8"> <link rel="stylesheet" href="styles.css"> </head> <body bgcolor="white"> <div id="container"> <div id="header"> <?php include 'includes/header.inc.php' ?> </div> <div id="includes/content.inc.php"> </div> <?php include 'includes/footer.inc.php' ?> </div> </body> </html> I would like to have the "content" include file name changed by the value of a variable. Is this possible. Sorry if this is obvious, I'm a newby and have been unable to find an answer so far. thanks, rwcurry Link to comment https://forums.phpfreaks.com/topic/184310-can-include-filenames-be-called-as-variables/ Share on other sites More sharing options...
Mchl Posted December 7, 2009 Share Posted December 7, 2009 Yes it is possible. $includeMe = 'file1.php'; include($includeMe); Link to comment https://forums.phpfreaks.com/topic/184310-can-include-filenames-be-called-as-variables/#findComment-973054 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.