Php Made Easy
Posted 01 March 2008 - 12:57 AM
by David Alderson
This is the one piece of code you need if you are new to PHP.
<?php include 'footer.php'; ?>
1. Insert this in your html.
2. Create a file in Front Page or Dreamweaver and name it footer.php
3. No matter how many pages you have this code on, when you update your footer.php file any page with this code will auto-update when your footer.php is loaded on the server with the changes you've made as long as your web page ends with .php
Make one for a header (header.php). Make one for a right side menu and put it in a table (right_menu.php). Make one for a left side menu, etc.
Throw away all of your .php tutorials, this piece of code is all you need to get started.
Posted 01 March 2008 - 01:11 AM
I wish I would have had this tutorial boiled down this easy for me to get started. I did the hello world tutorial which is good and I tried several other lessons.
Had anyone told me all I had to do was put that snippet into my html and that would insert the contents of my page wherever that code is, I would have been up and running in 5 minutes.
I give credit to this tutorial here, which got me to see the light quickly.
So let's say I want to add flash to my menu on my web site on the left side.
Well, now instead of making a change and copying and pasting updates of code in each individual web page I instead change my left_menu.php file and load it onto the server, and each of my pages that has the php code in the left table instead of a conglomeration of html and image codes is automatically updated with my php file contents.
How cool and easy is that!
Do it for a footer, a header, an anything really! That little code along with your contents creates all of your pages. Alter your footer.php, header.php or anything.php file and load it to the server, and anywhere that code appears, changes automatically take place.
This is the chase I always wanted to cut to as a business owner when it came to php, so I hope this helps other owners and those who want to have nice things in life by learning more about coding. Be it a personal page that looks nice, or their own mini-empire.
Thanks to everyone here who has taught me, I wanted to take 10 minutes tonight to give something back that might help out someone who's learning. Especially thanking Thomas and Bruce and Tina directly again, and so many others including the head guru who I'm learning from by browsing through the forums about every day
I was on the CPanel and Web Host Manager site tonight using the demo versions, and reading about the reseller packages here; who knows what comes next!
Edited by thedesignstudent, 01 March 2008 - 01:25 AM.
Posted 23 November 2009 - 12:20 PM
However I am running into a snag that I could use some help with.
I use template files alot, and when I cut and paste a template file into a sub directory, the path to the include file is not updated to reflect that the included file is now in a higher directory.
I tried to use a fully qualified name for the include file
Top Level <?php include("cssmenu.html"); ?>
Sub directory <?php include("http://www.My_Domain...m/cssmenu.html"); ?>
But I get a TCH error message
Warning: include(http://My_Domain.com/Footer.html) [function.include]: failed to open stream: no suitable wrapper could be found in /home/userName/public_html/Insert2.html on line 23
Warning: include() [function.include]: Failed opening 'http://www.kinky-vegas.com/Footer.html' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/userName/public_html/Insert2.html on line 23
I have no clue how to go about writing or installing a wrapper that will permit this, any help will be appreciated
I have two work arounds at present, but I would like to be able to simply include files from some of my other web resources in the current site
www.wyldeart.com - JayC@WyldeArt.com
www.cntlwire.com - firstname.lastname@example.org
Posted 23 November 2009 - 12:25 PM
If it used to be domain.tld/folder/cssmenu.html and you moved it to domain.tld/cssmenu.html, then you need to show the include relatively.
It would be:
Simmaster - <a href="http://www.swunleashed.net" target="_blank">SWUnleashed</a> | <a href="http://rpg.swunleashed.net" target="_blank">SWUnleashed Boards</a>
"I don't want to go!"
Posted 23 November 2009 - 12:27 PM
<?php include("/home/username/path-to-file/cssmenu.html"); ?>
TotalChoice Hosting, Inc.
Webhosting by Total Choice Web Hosting - General Support Forum
I am a Forum Moderator. While I can assist in answering most of your hosting related questions, I am unable to answer questions about specifics relating to your account such as billing and server related issues. Should you need assistance in these areas, please contact our Help Desk or our many other options. Another good place to find answers is with our help pages, tutorials and movie tutorials.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users