Hi Everyone,
I want to start a 'just for fun' project to learn how to code in PHP. I have found that I can understand and even edit some code that is already written, but can't write it myself.
I've seen a couple websites written by two different Russians. I've noticed their way of programming seems different from ALL the PHP examples I can find on the Internet. The thing is... I REALLY like the way they build their sites and want to know how they do it.
Here's what I want to do:
I created a folder in htdocs (apache 2.2 ) to house the files/folders.
I created folders called:
image
template
template/includes
- I created 3 files
header.html
menu.html
footer.html
and put them in the /template/includes
- I created an index.php file and put it at root.
By inserting PHP code into the 'index.php' file I can pull the header, menu, and footer and have it displayed as expected, but that's not what I want to do.
Here's what I really want to do:
I want to put that index.php file in the 'templates' folder
I want to make another index.php file and put it at root. I want it so when you refresh the site, it reads the index.php file at root and knows that my website homepage/index.php is located in 'templates' and then pulls that page along with the 'header, menu, and footer.'
I want to be able to put "<#header#>", "<#menu#>", and "<#footer#>" in the templates/index.php page and it's understood where these files are located and that the code from each of these pages is placed at that point.
That's it.
What I'm hoping to get from someone here.
- Maybe 10 minutes of someone's time who would be willing to attach a few files here that would show how to do this. I'd like to drop them into my localhost folder and see it work and then look at how you did it. If you were even more helpful and wouldn't mind giving another five minutes, I would LOVE it if you could create a forms.php file (example) and put in only one db (first_name) field. Then create a page called input.html, where that db field might be called by using <#first_name#>. I THINK all of that could be done in about 6 very simplistic pages and in no more than 10-15 minutes by one of you PHP experts.
I want to learn it using this method because I loved the way these Russians kept ALL the form fields in one page (forms.php), so you could see them all at once and then have it simply called in some .html page by using, for example, <#first_name#>. And, when you ran that page, you got a form text box right there where you could enter a name and then submit it to the MySQL db. It also worked in REVERSE. I would find on an output page something like <#first_name#> and sure enough the first name was pulled from db and placed there. The part that excites me is not the fact you can put data in a db from a form and retrieve it. I know we've been doing that for a long time. What I really like and want to learn is how to use "<#first_name#>" in a page and it works.
Is there anyone out there who finds this request simple enough who would be willing to demonstrate it for me in an actual website? If just these elements are there (nothing more), I should be able to understand it and then take my project much further by building on what I've just learned.
Thanks very much to anyone who's willing to do this.
P.S. This is a repost because someone took ownership of my previous request for help and said they would return later. However, he never made good on his offer and by then no one was coming back to it.