Then we create the HTML code with CSS styles, a menu and the content (see the whole code bellow). With this variable we get data for the current /accessed web page, like this for Title.Ĥ. We use strip_tags() function to remove posible tags added by visitor in URL, and trim() to delete whitespaces from beginning and end of the name.ģ. $pgname = isset($_GET) ? trim(strip_tags($_GET)) : 'index' If there is $_GET, we get the name of the page from URL, otherwise we set the default name "index" and get its data from Array. Then we set a variable with the name of the page. 'keywords'=>'meta keywords, of the, page'Ģ. 'description'=>'Here add the page description', To have different Title and Meta-tags in each page, we set an Array with Title, Description, and Keywords associated with the name of each page, "index" for Home page.
The content of each page (which can contains HTML code) is stored into a directory (here named " pages"), in ".htm" files, with the name: page_nme.htmġ. The page URL will have the form: index.php?pg=page_name We create a file: index.php with PHP instructions to define page data, HTML code, and CSS style for template ( the whole code for this file is presented bellow). In this tutorial you can learn how to quickly create a simple website in PHP, with different title, meta description, and content for each page.