
-----------------------------------
Homer_simpson
Fri Aug 22, 2003 10:55 pm

need help with not using frames...
-----------------------------------
well i been hearing lotsa stuff about frames not being good i decided to remove them from my website... but i still need a little help...
i'm giving shape to my website using tables like this :


  
    
Banner
    
  
  
    
      
        
          
            Menu
          
          
Main page
          
          
Poles
          
        
      
    
  


now each cell in those tables needs to contain a different .php file...
for example when in the menu.php which is located in menu cell in my table some1 clicks on members option i need the page to open members.php in the main cell in my table... how do i do that? and please dont tell me to have all my project in one big file...

-----------------------------------
octopi
Fri Aug 22, 2003 11:50 pm


-----------------------------------
Create a html file, containing the layout, and then in each cell put


require "thephpfile.php";

where the name corresponds to your php file. 

Good luck.

-----------------------------------
Homer_simpson
Sat Aug 23, 2003 1:53 am


-----------------------------------
aha TY man...i'll try that...
btw require is that an html keyword or php?
/edit nvm that /edit

-----------------------------------
octopi
Sat Aug 23, 2003 6:08 am


-----------------------------------
Its php code.
You can also use

include "thefile.php";

the difference between require and include, is basically what happens when php can't load the file.

Require will cause the program to halt, where include will just show a warning. It really depends on how you do it. But if you disabled warnings your users might get confused...(They wouldn't see anything there.)

-----------------------------------
Homer_simpson
Sat Aug 23, 2003 1:36 pm


-----------------------------------
In c++ u can use #IFDEF to prevent include files to be included twice... is there a way to do this in php?

-----------------------------------
Blade
Sat Aug 23, 2003 2:42 pm


-----------------------------------
use require_once() or include_once()
they will only require/include the file if it hasn't already been included.

-----------------------------------
Amailer
Sat Aug 23, 2003 3:58 pm


-----------------------------------
But including files is..err
idk

Use functions, i think that would be better

-----------------------------------
octopi
Sat Aug 23, 2003 7:37 pm


-----------------------------------
Well the best thing would be to....redesign the whole layout.

You should use pure html as much as posible. Do you really need the banner to be in php?

If you do then the best bet would be to make a html file with the layout you showed, and do what amailer mentioned.
Where you want your banner put:


and also put somewhere at the top



in your functions.php file you would put.


function display_banner () {
  //stuff goes here.
  //you can either return from this function, or just echo data inside it.
}


You would repeat this for the other sections.

-----------------------------------
Homer_simpson
Sun Aug 24, 2003 2:15 am


-----------------------------------
lol... well yes that is pretty much what i do... but i got some commonly used functions that i save on my include files so i dont have to redefine the functions every file...

-----------------------------------
PaddyLong
Mon Aug 25, 2003 10:51 am


-----------------------------------
I normally make one file with my layout done in html and then just have a get var that tells what page to load .... to make sure they don't load any file they want (like some remote script or something) I have an array that keeps track of the valid values for the get var and the values that go with them ...  so like if I had a home page called homePage.inc
my url for that would be something like 
www.somesite.com/?page=home

and then the array entry would be something like
pages['home'] = "homePage.inc";

and then in where the body of my page goes I do something like
include (pages[$HTTP_GET_VARS['page']]);

of course there is an if statement to see if the page var is set and if the file it's going to try to include exists

-----------------------------------
PaddyLong
Mon Aug 25, 2003 11:02 am


-----------------------------------
o yea... nice pic of Kerry in your sig Homer  8)

-----------------------------------
Amailer
Mon Aug 25, 2003 11:24 am


-----------------------------------
i just keepmy information in a mysql DB.
That way i can ezly edit delete and add :D

-----------------------------------
Homer_simpson
Mon Aug 25, 2003 1:09 pm


-----------------------------------
o yea... nice pic of Kerry in your sig Homer  8)
THX http://forums.networknext.com/pcpp/images/smiles/icon_headbang.gif


I normally make one file with my layout done in html and then just have a get var that tells what page to load .... to make sure they don't load any file they want (like some remote script or something) I have an array that keeps track of the valid values for the get var and the values that go with them ... so like if I had a home page called homePage.inc 
my url for that would be something like 
www.somesite.com/?page=home 

and then the array entry would be something like 
pages
well ya i had problems with variables and include files... and setting a variable for the main URL is exactly what i did... but more importantly all the absolute positionings get fucked  :(  so i gotto rewrite a lotta shit to change frames in to tables...

-----------------------------------
PaddyLong
Mon Aug 25, 2003 3:13 pm


-----------------------------------
... that layout shouldn't take very long to write as a table....




banner



menu
body




for the adding pages thing, I just wrote a little function that does it ... it takes the value you want for the url and the file name and puts them into the array (it also takes a couple other things, like title/"breadcrumb" to display, etc)

-----------------------------------
Homer_simpson
Mon Aug 25, 2003 6:18 pm


-----------------------------------
Absolute positioning!!!!
tables cannot do anything to change absolute positioning...

-----------------------------------
PaddyLong
Tue Aug 26, 2003 10:57 am


-----------------------------------
well.. yes, you can do absolute positioning with tables... blank cells are good for it... but if you mean using stylesheets, you can still use tables with that as well... just give certain cells or tables or whatever the class attribute ... css is very very nice :)

also, I dunno what sort of absolute positioning you plan to be doing that tables won't work :/
