Ok, I am going to create a site, and want to use PHP, yet I do not know much about it, and the tutorials are not helping me. I am more of a 'look and play' person. I don't and can't follow tutorials, and I don't learn as fast. But I can view code, with comments, mess with it, see what it does, and in the end, I learn more... So, I want to start out with: 1. A banner that shows up in every page 2. A navigation bar that shows up in every page and maybe have those on seperate pages, or the same page so I only have to edit it once... not 1000 times like with html....
I can rep anyone that helps me, and you cant stop me.... well, you technically can if you stop me from repping, but anyway, I can rep who I feel really helped me... I'm not doing it in a matter of currency, I'm just doing at as a friendly person...
Ok, now if anyone can help me make the nav bar on the left side, like most websites do, please help. I think that you would just post it in a table, and put it on the left side of the table, I dont know exactly...
I am a lazy php developer, feel free to contact me on msn [email protected] Normally on time from uk evenings/early mornings (like 8pm-2am sorta thing) Daz
Ok, the basics of how I would make a page using PHP-Includes: First make a new file (index.php) in dreamweaver and do all the HTML of how you want the layout of the frontpage (and all the other pages). As far as the content area is concerned, put the following code where you would want all the content to show up: Code: <?php include($file) ?> What this is doing is telling the parser to include contents of a variable - $file. Now as I'm sure you've realised, this hasnt been set yet. Make a new file called header.php and it in put the following (get rid of any HTML so its blank first): Code: <?php switch($HTTP_GET_VARS['page']) { case '': $file = 'home.php'; break; case 'contact': $file = 'contact.php'; break; } ?> You dont really have to understand this code, but basically its checking for an HTTP variable (i.e. index.php?page=content) and then setting the variable $file with the name of the appropriate file (i.e. home.php). Following me so far? Next, go back to your index.php file and at the very top (above any HTML) put the following code: Code: <?php include("header.php"); ?> The final thing you have to do is page 2 files; 1 called home.php and 1 called contact.php. Put in any content (even if its just temporary) for a home and contact page in the corresponding file and upload it to a PHP-compliant webserver. To test it, go to www.yoursite.com/yourfolder/index.php and hopefully you will see your page design and in the content area you should see the content you put for the homepage. To see the contact page, go to www.yoursite.com/yourfolder/index.php?page=contact and you should see your contact page content in the content area Hope this made sense and even if you dont know much PHP you should be able to modify it accordingly to work with other pages. Feel free to post if you have any questions.
Thanks. I have a small programming background, so I understand how things need to be called before they can be used... [edit] My 901st post!!!![/edit]