PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old October 13th, 2002, 12:14 PM
roberto_nl roberto_nl is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Sep 2002
Location: The Netherlands
Posts: 19 roberto_nl User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question PHP Include

hi people. i just started working with php, so i dont know mutch about it. so please excuse me for asking (maybe for you) easy questions...
ok, the problem:
i've got index.php but most of it is HTML.
in index.php i'm using tables, in left table i've got
<?php include("something.php"); ?>
in something is displaying stuff (on click etc...) using print funcion.
but i want something.php to print this stuff in this left table or in main table.
i hope you can understand what i mean.

greetZ

Reply With Quote
  #2  
Old October 13th, 2002, 02:22 PM
dhaval_adams dhaval_adams is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: Dubai
Posts: 24 dhaval_adams User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to dhaval_adams
It's easy..

Hi!

Well it's not difficulat at all. Since all of the stuff that yuo want to display is html. Fire up Dreamweaver or any of your favourite WYSIWYG Editor and open the index.php file. Let's say you want to get your navigation which is on the left column of your table as an include file. Just do as follows:


First Main Table with 3 columns.
First column has the navigation, second and the tirhd could have anything...
In the first column just insert your navigation in a table...which ould be easily copied an pasted into a new file let's say left.inc.php and then your code will be as fillows:


I have the two files as example....


Contents of index.php
--------------------------------------
<table>
<tr>
<td><?php include("./left.inc.php"); ?></td>
<td>2nd column</td>
<td>3rd column</td>
</tr>




</table>




Contents of left.inc.php:
-------------------------------------------

<table>
<tr>
<td>Link 1</td>
</tr>
<tr>
<td>Link 2</td>
</tr>
<tr>
<td>Link 3</td>
</tr>


</table>





Hope it helps....don't hesitate to post any more questions that you may have....



Best Regards,
Dhaval

Reply With Quote
  #3  
Old October 13th, 2002, 02:59 PM
roberto_nl roberto_nl is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Sep 2002
Location: The Netherlands
Posts: 19 roberto_nl User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
ok, but how how do i get php to print it in the maintable?
ive got top table with navigation
then <table>
and this in 3 columns, left stuff, main text en right stuff.
how do i get it to display anything i want in the main table?
i dont know mutch about php, but i was thinking of making a varible $main=somsthing.htm or something, and changing it by navigation...
like i to <include $main> in the main table, and navigation will change the varible, and so change the included file...
do you think it could work ?

and if it could, could you show me how i can do it the best way ?
i only ve got the idee, not the php knowlage

greetz

Reply With Quote
  #4  
Old October 14th, 2002, 01:05 AM
dhaval_adams dhaval_adams is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: Dubai
Posts: 24 dhaval_adams User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to dhaval_adams
No Variables....

Hi!


If you make any changes to the left.inc.php file it will change wherever it was included. As I had shown in the above example...Copy the code that I had made in two different files...index.php and left.inc.php. Run it on a webserver and see what happens...then change the content of the left.inc.php and then run index.php and see what happens.

You will see that you have achieved what you wanted....and you don't need to set any variables and stuff for such a simple thing...


Regards,
Dhaval

Reply With Quote
  #5  
Old October 14th, 2002, 06:21 AM
roberto_nl roberto_nl is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Sep 2002
Location: The Netherlands
Posts: 19 roberto_nl User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
ok, but how does that navigation stuff work?
i often see "index.php?article=13" or something
so it displays article 13 by clicking on some link...
does someone have an example of script working like that?

greetz,
roberto

Reply With Quote
  #6  
Old October 14th, 2002, 07:42 AM
Ben Rowe
Guest
Dev Articles Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
index.php?article=13,

this usually means that the article is comming from some sort of indexed database. Which for begginners, gets a big complicated

as a basic idea, you could have something like this

file.php?file=index.php

then have this script in the file.php page

PHP Code:
<?php

include($_GET['file']);

?>


This would include the index.php file into the file.php

Reply With Quote
  #7  
Old October 14th, 2002, 10:05 AM
roberto_nl roberto_nl is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Sep 2002
Location: The Netherlands
Posts: 19 roberto_nl User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
php navig problem

ok, now i've got
PHP Code:
<?php

include($_GET['file']);

?>


and it's working.
so i've got the main site, and i the main table i've got thiat include script.
now by clicking on links like "file.php?file=index.php"
i get to include files to this table.
but when the main site is opening, i want to load index.php into the main table, because people are starting to clicking on the links later.
how do i get to do it ?

greetz

Reply With Quote
  #8  
Old October 14th, 2002, 12:03 PM
Taelo Taelo is offline
5B's
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: PC, FL
Posts: 366 Taelo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 30 m 59 sec
Reputation Power: 7
in your main table just include it
PHP Code:
include("file.php"); 


the $_GET is used if you are appending information to the address bar. such as index.php?file=main.php you are getting the file main.php

so if you want the php page to be visible when the html page loads, all you need to do is include the php page in one of your html tables.

Reply With Quote
  #9  
Old October 14th, 2002, 01:50 PM
dhaval_adams dhaval_adams is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: Dubai
Posts: 24 dhaval_adams User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to dhaval_adams
That's rite...

Yeah..

If you want to include a file, just include it in the table....
<td>
<?php include("./includefile.inc.php"); ?>
</td>

Best Regards,
Dhaval

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingPHP Development > PHP Include


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT