Tuesday, December 18, 2012

My FirSt PHP ProjeCt.


Because this is the first time i will create PHP interface and start 
doing my final PSM project, i have search the web for this and i found 
one. Here allocation for the web. With my ankel help, i start discover 
what's the instruction is all about. 

I will take the introduction from the web.

Whether you have a small or a huge website, you know how much hassle 
and time it takes to upgrade your web site pages. The upgrade process 
becomes even more irritating when you make a change that needs to be 
upgraded on every page of your website; a good example of such a change 
is adding a button to the header or changing the copy right information 
in the footer of your website.  

What u need to start is :: 

1. Requirement :
>> Server/Hosting capable of running php scripts.


2.The Tutorial :

Step 1
Create a folder on your server and name it "design".
Create another folder and name it "pages"

- i have create those folder in my public_html folder
     [dora@localhost ~]$ cd public_html
     [dora@localhost public_html]$ ls
     = design  pages  rnd  smf

- but we must set directory
  >> define folder to become DocumentRoot

     [dora@localhost public_html]$ pwd
     = /home/dora/public_html

     [dora@localhost public_html]$ mkdir project1
     [dora@localhost public_html]$ ls
     = design  pages  project1  rnd  smf

     [dora@localhost public_html]$ mv design  pages project1/
     [dora@localhost public_html]$ ls
     = project1  rnd  smf

     [dora@localhost public_html]$ cd project1
     [dora@localhost project1]$ ls
     = design  pages

- now, project1 is my DocumentRoot for the design. :)
  because the best way do not mess up DocumentRoot with other files.

Step 2
Now in the root directory create a file and give it the 'index.php'

** my DocumentRoot is 'project1' folder
   so i will put index.php inside 'project1'

     [dora@localhost project1]$ pwd
     = /home/dora/public_html/project1
     [dora@localhost project1]$ ls
     = design  index.php  pages

Step 3
In the "pages" directory, create a page and give it the name: 'main.html'

     [dora@localhost project1]$ cd pages
     [dora@localhost pages]$ nano -w main.html



     [dora@localhost pages]$ ls
     = main.html

     [dora@localhost pages]$ cd .. (cmd for return dir.)

Step 4
Add the following code to your 'index.php' file

     [dora@localhost project1]$ nano -w index.php



Step 5
Create the following files in the design folder:
'header.html', 'footer.html', 'right_column.html', 'left_column.html'

-> header.html
   [dora@localhost design]$ nano -w header.html



-> footer.html
   [dora@localhost design]$ nano -w footer.html



-> right_column.html
   [dora@localhost design]$ nano -w right_column.html



-> left_column.html
   [dora@localhost design]$ nano -w left_column.html



** and to add a little touch to my design, i've create a 'styles.css' 
   file in the design folder and add the following code:

-> styles.css
   [dora@localhost design]$ nano -w styles.css



** Now give it a test drive spin!

   http://server.www.project1

   noted :: i just follow the intructions from this web.

Actually it wont work. The tutorial is not complete. The main.html didnt call the css scripts. Now i have to edit main.html
   
   [dora@localhost pages]$ nano -w main.html
   


EXAMPLE OF PHP INTERFACE - from the tutorial.

addition :: system checking. su - [root@localhost ~]# find / -name httpd.conf = /etc/httpd/conf/httpd.conf [root@localhost ~]# cat /etc/httpd/conf/httpd.conf |grep text/css >> nano -w /etc/httpd/conf/httpd.conf find the empty line :: fill in => AddType text/css .css then save. [root@localhost ~]# apachectl configtest [root@localhost ~]# apachectl restart EDITING CSS THAT I DO.. :P http://server/www/project1/index.php/page=main.html
i will edit more later. hehe. i must read about HTML/CSS scripts more. done for now.