Beginners Tutorial
From phpCMS
This article needs additional content.
Please remove this message from the page after completing the article and make also sure that the page has been removed from the listing on the needs content-page.
This page will contain an easy phpCMS tutorial for beginners which explains how to use phpCMS from the very beginning in small and simple steps (read [page] for some ideas on this article ...)
Contents |
[edit] phpCMS for Beginners
[edit] First Step: Installing phpCMS
This tutorial assumes that the phpCMS has been installed to your webserver's root directory like described on the Quick Installation Guide. You can leave the demo where it is, it isn't needed at the moment (but you may have a look in there later, of course).
[edit] Second Step: Creating Content and Template Directory
Create a new directory for this tutorial named tutorial beside the parser directory. Then create a template directory below /tutorial. You should now have the following directories on your webserver:
/parser /tutorial /tutorial/template
Please note that you can use a different directory structure in the future, these are examples for this tutorial.
[edit] Third Step: Making the first very simple page
[edit] The first project file
Create a single file called home.ini with the template directory. It has the following content:
; name of the field := value of the field
HOME := /tutorial
PLUGINDIR := /parser/plugs
TAGS := $home/template/home.tag
TEMPLATE := $home/template/home.tpl
MENU := $home/template/home.mnu
MENUTEMPLATE := $home/template/home.mtpl
EDITPASSWORD := yourpasswordhere
This file is necessary to tell the phpCMS parser which template it has to use for your content files. There are several more fields used in this file, but we'll explain them later. Please pay attention that HOME has to be the very first entry.
[edit] The first template file
Create a single file called home.tpl within the template directory. It has the following content:
<?xml version="1.0" encoding="ISO-8859-15"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>{TITLE}</title> </head> <body> {CONTENT} </body> </html>
I used Doctype XHTML 1.0 Transitional for this example but of course you're free to choose the one you want to.
This template contains only two phpCMS placeholders at this moment:
- {TITLE} - The place where the title of the page will be displayed
- {CONTENT} - The place where the actual content of the page will be displayed
[edit] The first content
Now we're ready for the first content page: Create a file called index.htm or index.html. For correct file extention check your "Parser - Configuration and Options" field "Page Extension to be parsed". Ok, index.htm should look like follows:
{PROJECT}
./template/home.ini
{TITLE}
phpCMS Tutorial
{CONTENT}
<h1>phpCMS Tutorial</h1>
<p>This is my first page with phpCMS!</p>
This content file contains three placeholders:
- {PROJECT} - This entry is the path to the project file home.ini
- {TITLE} - The title of the page which will be placed like it has been noted in the template file
- {CONTENT} - The actual content which will be displayed within the <body> tag.
Upload this content file into your tutorial directory. Now we have to upload a few files which aren't actually needed at this moment but phpCMS needs them, these are:
- the menu file home.mnu
- the menu template home.mtpl
- the standard tag file home.tag
You can take these two files from the demo directory an copy them to the /tutorial/template directory. Now you should have the following files on your webserver:
/tutorial/index.html /tutorial/template/home.ini /tutorial/template/home.tpl
like describe in the previous steps and the additional
/tutorial/template/home.mnu /tutorial/template/home.mtpl /tutorial/template/home.tag
[edit] Call the first page
And now you're ready to call your first phpCMS webpage:
http://yourserver.com/tutorial/index.html
if you are using Stealth Mode or, without Stealth Mode:
http://yourserver.com/parser/parser.php?file=/tutorial/index.htm
If everything worked right, you should see the following:
[edit] Fourth Step: Splitting up Templates
[edit] Fifth Step: Adding a Menu
Main Page: Main Page | Top Page: Tutorials MainPage


