I'm new to PHP so please bare with me with me if this is an easy question, I tried searching but really didn't know what I was searching for. How would you do an include with PHP where the variable is called from the page not the template. I know some coldfusion so I'll try and give an example using that. On my web page (mypage.cfm) I would have the following: <cfset street="Elm"> <cfset city="Chicago"> <cfinclude="mytemplate.cfm"> Code (markup): then on the template (mytemplate.cfm) I would have: <cfoutput>#street# #city#</cfoutput> Code (markup): that would output on mypage.cfm Elm Chicago Code (markup): How do I do this using PHP?
I would use some $_POST values and <form> to submit the data and then pass it on using $_POST['value_here'] to get the value from the form. http://www.w3schools.com/php/php_forms.asp
I don't have a form to post from.. this is just to create similar pages with different names and different content. I just want to create hard coded pages using a template and called variable.
<?php $street="Elm"; $city="Chicago"; include 'mytemplate.php'; ?> PHP: mytemplate.php <?php echo $street . " " . $city; ?> PHP: You can output html for formatting as well. php.net is a great resource for everything you may need to reference. If you know how to do something in the other language, you will know what functions to look for there. Here is the link to include... http://us3.php.net/manual/en/function.include.php