Forum Moderators: open
I've been 'off the scene' for quite some time and I'm just getting back into it having been asked to do a bit of charity work.
I need some basic content up quick. I would like to get to grips with php and am wondering on the best available 'beginners guide' out there for getting basic results pronto? I have the feeling I should just code up some html pages and then work on a php version for later perhaps, but I'm not sure yet. I have glanced over a few php pages and it looks like it ought to be pretty simple to achieve a few basic pages maybe as quick as I could in html which I already know. Maybe I'm also slightly mistaken in assuming that php effectively 'replaces' html as a language of sorts?
Sadly time is of the essence and I son't have a huge ammount on my hands these days.
Cheers
Mr Cat
The PHP script is used to output a page of HTML, some elements of which have been built as a result of programmatic decisions within that script.
The most useful PHP feature is INCLUDE files. It allows the "page" to be built from chunks of code, and for single chunks to be re-used in multiple pages of the site over and over again.
That allows site-wide changes to be very rapidly implemented. The usage of CSS for styling is crucial. Separation of content and style, once you cross that bridge, opens a whole new way of thinking - you won't go back.
For example your php page might contain something like this with HTML and PHP mixed:
<html>
<head>
<title>Some Title</title>
</head>
<body>
<?php
include($_SERVER['DOCUMENT_ROOT'] . '/includes/header.php');
>?<p>Some content</p>
<?php
include($_SERVER['DOCUMENT_ROOT'] . '/includes/footer.php');
>?</body>
</html>
The server simply outputs the first part as text until it hits the <?php where it switches to php mode. In this case its going to include a file called header in a folder called includes.
Whatever is in header.php is executed or outputted. You might for example want to inlcude all the basic header and navigation for your site here. To change the navigation site wide you only have to edit one file.
Although a great feature it's really one of the most simplistic ways you can use php . As mentioned its a programming language which opens all kinds of doors, the possibilities are endless.
The full manual can be found here: [php.net...]