Integrating your website with PHP
Programming
|
PHP is nice coding language. With it, you can do many things, like guest books, different calculators and so on. With PHP, you can also easily integrate your website.
You can see Integration example in use HERE:http://www39.ikolnet.fi/test/
See, it's working nicely. All you need are do is:
Make links like this:
|
CODE:
|
Copy / Restore :: Remove Scroll Bars
|
<a href=".">Home</a> <a href='?act=1'>First</a>
Select what you want to copy and in doing so you will keep the formatting when pasting it.
|
|
Beginning of PHP:
|
CODE:
|
Copy / Restore :: Remove Scroll Bars
|
<? switch($_GET['act']){ default:
Select what you want to copy and in doing so you will keep the formatting when pasting it.
|
|
Then, after that default, add whatever you like to see in the index. In example, there is lines like this:
|
CODE:
|
Copy / Restore :: Remove Scroll Bars
|
echo 'Welcome to this site'; break;
Select what you want to copy and in doing so you will keep the formatting when pasting it.
|
|
Remember to add (break;) after all the code you like.
Then, let's add what is after the that link(this is picked from example site's code:
|
CODE:
|
Copy / Restore :: Remove Scroll Bars
|
case"1": echo 'Here are example of url'; echo '<br>'; echo '<a href="http://www.CoderProfile.com" target=_blank>Coder
Profile</a>'; break;
Select what you want to copy and in doing so you will keep the formatting when pasting it.
|
|
See, you can use HTML inside echo, so you can add whatever you like to your site, even it is still the one same file...
After writing the code, lets end the PHP:
|
CODE:
|
Copy / Restore :: Remove Scroll Bars
|
Select what you want to copy and in doing so you will keep the formatting when pasting it.
|
|
and you're done! it's that simple.
Like this, you can easily cut down small files in your website. If you make your site like this, you just have to edit few files in your website, even if your website is HUGE. This is pretty simple example though. If you know what to do, you can even integrate PHP/MySQL stuff into your website. It's a bit harder to make, but it's not impossible. Also, you can name the integrations, simply change the 1 in (<a href='?act=1'>First</a>) and in (case"1":) to anything you like. It's recommended to name those to represent the code what is in there. If you have for example Links to several sites in there, name it something like (links) or (urls) or whatever you like. It makes the code way more comfortable to edit like that, and sites url tells what is in there... Go figure, possibilities are endless.
Here is the complete source of that example site:
|
CODE:
|
Copy / Restore :: Remove Scroll Bars
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Index</title> </head> <body> <table width=800 height=150 border=0> <tr><th></th></tr> </table> <table width=800 height=700 border=0> <tr> <th width=260 valign="top" scope="row"><div
align="left"> <p><strong><a href=".">Home</a></strong></p> <p><strong>Something:</strong></p> <ul> <li><a href='?act=1'>First</a></li> <li><a href='?act=2'>Second</a></li> </ul> <p><strong>More something:</strong></p> <ul> <li><a href='?act=3'>Third</a></li> </ul> </div></th> <th width=440 valign="top" scope="row"><div
align="center"> <? switch($_GET['act']){ default: echo 'Welcome to this site'; break; case"1": echo 'Here are example of url'; echo '<br>'; echo '<a href="http://www.CoderProfile.com" target=_blank>Coder
Profile</a>'; break; case"2": echo 'its nice when your website is in one file'; break; case"3": echo 'Needs less bunchies'; break; } ?> </div></th> </tr> </table> </body> </html>
Select what you want to copy and in doing so you will keep the formatting when pasting it.
|
|
Have fun with this!
Please login to rate coding articles.
Click here to register a free account with us.
|
|
Comments
|
| Please login to post comments. |
|
|
Oh, also, TAB! Tabbing looks better and again, is back to using standards.
|
|
|
I don't know about easier, but it's better when being a "better programmer" and writing in standards. Short hand is just bad practice.
|
|
|
 |
Categories |
 |
|
|