|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 |
|
#2
|
|||
|
|||
|
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 |
|
#3
|
|||
|
|||
|
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 |
|
#4
|
|||
|
|||
|
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 |
|
#5
|
|||
|
|||
|
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 |
|
#6
|
|||
|
|||
|
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:
This would include the index.php file into the file.php |
|
#7
|
|||
|
|||
|
php navig problem
ok, now i've got
PHP Code:
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 |
|
#8
|
|||
|
|||
|
in your main table just include it
PHP Code:
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. |
|
#9
|
|||
|
|||
|
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 |
![]() |
| Viewing: Dev Articles Community Forums > Programming > PHP Development > PHP Include |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|