Monday, September 3, 2012

Php Tutorial

We have the power to learn. Yes learning to program using php is really not as hard as people think. The only hard thing about it is remembering where you place everything. Php and Html work very good together. Especially if you use PageParts. PageParts are partial page pieces that you can add into certain pages as needed or use on every page. A good page part would be the Head section of your site. Along with the horizontal page menu. So by using the INCLUDES function, we can do wonders with PageParts. Now to help us out mentally we call these PageParts MODULES. Easy to remember and now you understand the basic concept of Modules and php. You may have several modules to create. Examples would be Header's, Menu's, Content's, Script's, Views, Functions, Configs, Footers, and Images. Now we know that Modules can be everything broken down into Views, Scripts, and Configs. A Config File is a page you would want to declare certain Variables that allows you to change things like page-names or Url Paths and Links without having to change these on every single page. Example of these might be     $url_home="index.php"; which allows you to change the index.php to another page named home.php without having to enter it into all your sites pages because on all the pages the link is shown as <a href="<?php $url_home; ?>">Home</a>  Here it calls the data from your config file and automatically tells the link to go to the Value of $url_home,,,which equals index.php and can be any page you choose. like change it in the config.php file and it will change that page on all your sites pages. Another good use would be assigning your database config. $db_name="database-name, $db_user="database-user-name", $db_password="password here". Place Admin and Editor Variables as well here to,     $admin="your private admin login name here";     and $editor="editors name here";    Now you have a config.php file that you can add alot of things to later.

No comments:

Post a Comment