Still confused... PHP

This is a discussion on "Still confused... PHP" within the Starting Out section. This forum, and the thread "Still confused... PHP are both part of the Design Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Design Your Website > Starting Out

Notices




Reply
 
LinkBack Thread Tools
  #1  
Old Sep 25th, 2007, 10:23
Junior Member
Join Date: Sep 2007
Location: UK
Age: 21
Posts: 31
Thanks: 4
Thanked 0 Times in 0 Posts
Still confused... PHP

So, I've got a basic index.html file and I want to convert it into php, so i've changed the extension... thats all fine.

BUT I want to use an include so I can change one part of my menu on all files without having to do it on a million seperate files.
The only thing is, my menu is included in the index.php file, its not got a seperate file...

I hope you get what I mean, I can explain more if needed.

Thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Sep 25th, 2007, 10:40
Highly Reputable Member
Join Date: Apr 2007
Location: Willich, Germany
Age: 20
Posts: 593
Blog Entries: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Still confused... PHP

Well then move the menu to a separate file and include the new external file in the exact same place in index.php where the menu was before.

I'm not quite sure if I understood your question right, so if that doesn't make sense, then could you please clarify the question or post some code.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Sep 25th, 2007, 10:46
Junior Member
Join Date: Sep 2007
Location: UK
Age: 21
Posts: 31
Thanks: 4
Thanked 0 Times in 0 Posts
Re: Still confused... PHP

So if I moved the code for my menu to a seperate file that would work, but then what esactly do I put where my menu was?

Thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old Sep 25th, 2007, 11:51
Elite Veteran
Join Date: Jan 2007
Location: You know where
Age: 31
Posts: 4,617
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Still confused... PHP

Just put the include statement!

PHP: Select all

<html>
<head>
    bla bla bla
</head>
<body>

<!-- navigation was here -->
<? include("menu.html"); ?>

bla bla bla

</body>
</html>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5  
Old Sep 25th, 2007, 17:17
alexgeek's Avatar
Moderator

SuperMember
Join Date: Jul 2007
Location: Webforumz 24/7
Age: 15
Posts: 3,812
Blog Entries: 9
Thanks: 2
Thanked 2 Times in 2 Posts
Re: Still confused... PHP

Quote:
Originally Posted by karinne View Post
Just put the include statement!

<!-- navigation was here -->
<? include("menu.html"); ?>
</body>
</html>[/php]
short tags might not be supported
use:
<?php include("menu.html"); ?>
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6  
Old Sep 25th, 2007, 18:45
Junior Member
Join Date: Sep 2007
Location: UK
Age: 21
Posts: 31
Thanks: 4
Thanked 0 Times in 0 Posts
Re: Still confused... PHP

Okay, i've done what has been said but the page is just coming up without the navigation now.

I've saved a file called 'nav.inc' which just contains :
<ul>
<li><a href="me.html" title="me">Me</a></li>
<li><a href="art.html" title="you">You</a></li>
</ul>


and in my index page where that was I have:

<div class="sbititle">Navigate</div>
<div id="sbinav">

<?php include('nav.inc'); ?>

</div>

I can't see where im going wrong, unless its something to do with the div's in my code around the navigation.

Thanks for all your help so far.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7  
Old Sep 25th, 2007, 18:50
Elite Veteran
Join Date: Jan 2007
Location: You know where
Age: 31
Posts: 4,617
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Still confused... PHP

Is the index page saved as index.php?

Is the nav.inc page in the same folder as the index.php page?

Does your server support PHP?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #8  
Old Sep 25th, 2007, 19:00
Junior Member
Join Date: Sep 2007
Location: UK
Age: 21
Posts: 31
Thanks: 4
Thanked 0 Times in 0 Posts
Re: Still confused... PHP

yes, it's index.php and yes - they are in the same folder.

Ok, I think i've been very silly! Does it have to be on a server to work then? I've been testing it locally!?!

I really am a beginner, so you'll have to excuse my naiveity.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #9  
Old Sep 25th, 2007, 19:05
Elite Veteran
Join Date: Jan 2007
Location: You know where
Age: 31
Posts: 4,617
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Still confused... PHP

Yes ... it needs to be on a server. PHP is a server-side language.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #10  
Old Sep 25th, 2007, 19:06
alexgeek's Avatar
Moderator

SuperMember
Join Date: Jul 2007
Location: Webforumz 24/7
Age: 15
Posts: 3,812
Blog Entries: 9
Thanks: 2
Thanked 2 Times in 2 Posts
Re: Still confused... PHP

Quote:
Originally Posted by ssnerdy View Post
yes, it's index.php and yes - they are in the same folder.

Ok, I think i've been very silly! Does it have to be on a server to work then? I've been testing it locally!?!

I really am a beginner, so you'll have to excuse my naiveity.
Ha, thought it'd be something like this.
you'll have to install php and a webserver program
search for XXAMP on google.
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #11  
Old Sep 25th, 2007, 19:06
Junior Member
Join Date: Sep 2007
Location: UK
Age: 21
Posts: 31
Thanks: 4
Thanked 0 Times in 0 Posts
Re: Still confused... PHP

oops...DOH!

Thankyou very much!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #12  
Old Sep 25th, 2007, 20:52
Elite Veteran
Join Date: Dec 2005
Location: On Internet
Posts: 4,859
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Still confused... PHP

As Karinne and Alex menthiod. PHP is a server side programming langude. So it only works when uploaded to your website host. Although, you can run a server locally though XAMPP. XAMPP's name is an acronym for X (any of four different operating systems), Apache, MySQL, PHP and Perl.

Any questions, just ask!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #13  
Old Sep 29th, 2007, 08:50
Jack Franklin's Avatar
Moderator

SuperMember
Join Date: May 2007
Location: Cornwall, England
Posts: 1,405
Blog Entries: 8
Thanks: 18
Thanked 14 Times in 14 Posts
Re: Still confused... PHP

There's also WAMP. There's a great video tutorial on killerphp.com on how to install WAMP for local use
Last Blog Entry: A Week with VBulletin (Aug 28th, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #14  
Old Sep 29th, 2007, 09:31
Highly Reputable Member
Join Date: Jul 2006
Location: Devon, England
Posts: 565
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Still confused... PHP

Quote:
Originally Posted by jackfranklin View Post
There's also WAMP. There's a great video tutorial on killerphp.com on how to install WAMP for local use
Also there is a tutorial here http://www.puremango.co.uk/cm_wamp_97.php

That's how i installed WAMP
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #15  
Old Oct 1st, 2007, 10:29
Junior Member
Join Date: Sep 2007
Location: UK
Age: 21
Posts: 31
Thanks: 4
Thanked 0 Times in 0 Posts
Re: Still confused... PHP

Thanks very much guys!

I since, uploaded my documents to my host and found they were all working fine, but i'll keep in mind what you said about doing it locally. Thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Now im really confused cressy Scripts and Online Services 1 Aug 4th, 2007 08:14
Confused $_SESSION SoulAssassin PHP Forum 2 May 18th, 2007 14:44
Confused!!! TwentyFourSeven Website Planning 2 Apr 28th, 2007 05:57
Confused wanna be, need much help Helpless Web Page Design 1 Nov 30th, 2006 04:00
Confused with links sspecialme11 Link Building and Link Sales 0 Sep 13th, 2006 16:01


All times are GMT. The time now is 14:06.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42