Have a little problem, would appreciate some advice.
Have a html site I am working on….
It should really be a php site, I really need to add some dynamic features.
Now, how do I go about converting the html pages to php … obviously I realise I can change the extension to .php
But really all that does is change the extension, no code will be changed.
I am seriously doubting that would suffice, surely I would need to change the code on the page, or at least parts of it.
Any advice or pointing in the right direction would be appreciated a lot.
P.S. I appreciate this may seem like such a trivial and silly question … but believe me, I have looked on the web and can not a definitive answer ….
I did search youtube ….. Most where php tutorials, as in starting with php.
I am more asking about converting a built html site to php …
But I will give the video you linked a view, but that seems to be a tutorial about building from the start, I unfortunately or fortunately ,whichever I way I choose to look at it have the html and CSS side done.
I aint worried about the work, more curious to find out if it is a task rather than people telling you, you just need to change the file extension (which I am sure is defiantly not the case)
Though thanks for your reply
- Sold between 250 000 and 1 000 000 dollars
- Community Moderator
- Author was Featured
- Item was Featured
- Bought between 50 and 99 items
- Referred between 1000 and 1999 users
- Has been a member for 3-4 years
- Repeatedly Helped protect Envato Marketplaces against copyright violations
Changing the extension to .php will mean that the file is parsed by the PHP engine before being served. If you don’t include any PHP code in the .php file, it’ll be served exactly like an HTML file.
Once you change the extension, you can begin adding PHP code to it. A simple example would be to extract the common code into a file that can then be included in each of your files. Something like header.php, then at the top of your individual pages files, you’d add
<?php include( 'header.php' ); ?>
Of course, changing your extensions will also change your URLs if you’re not using pretty URLs/mod_rewrite
I highly recommend picking up a PHP book or following a PHP tutorial online if you intend to start using PHP . These are the types of basic concepts you’ll need to understand as a foundation to building a PHP site
Hope that helps!
Thank you for your detailed reply …
Yes …. I see what you mean, I do have some php already in the code (log in etc) but really need to add more like a footer include. (obviously bought code)
I have looked on the tutorials here and there doesn’t seem to be anything … so back to subscribing to Lynda for a couple of months ….
It looks like it might not be the arduous task I am convincing myself it is going to be …. then again, at the moment I cant look very far ahead
I agree with Chris – as a start, change your extensions from html to php and then jump into includes to share the most common items. It’s a pretty big topic to cover in a forum post but PHP is extremely popular, there are no shortage of tutorials out there. Take it one step at a time.http://net.tutsplus.com/tutorials/php/the-best-way-to-learn-php/
That video was just the first part there are more videos where you can learn how to include header, footer, sidebar, etc.
Thanks for the link you posted, lots of information there to start with … obviously I need to refine my Google search abilities also
MC – Yes, just seen that it was part 1 of many , I have a habit of jumping the gun ,
Thanks again to all for your advice, its appreciated