Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 need help with not using frames...
Index -> Programming, PHP -> PHP Help
Goto page 1, 2  Next
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Homer_simpson




PostPosted: Fri Aug 22, 2003 10:55 pm   Post subject: 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...
Sponsor
Sponsor
Sponsor
sponsor
octopi




PostPosted: Fri Aug 22, 2003 11:50 pm   Post subject: (No subject)

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




PostPosted: Sat Aug 23, 2003 1:53 am   Post subject: (No subject)

aha TY man...i'll try that...
btw require is that an html keyword or php?
/edit nvm that /edit
octopi




PostPosted: Sat Aug 23, 2003 6:08 am   Post subject: (No subject)

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




PostPosted: Sat Aug 23, 2003 1:36 pm   Post subject: (No subject)

In c++ u can use #IFDEF to prevent include files to be included twice... is there a way to do this in php?
Blade




PostPosted: Sat Aug 23, 2003 2:42 pm   Post subject: (No subject)

use require_once() or include_once()
they will only require/include the file if it hasn't already been included.
Amailer




PostPosted: Sat Aug 23, 2003 3:58 pm   Post subject: (No subject)

But including files is..err
idk

Use functions, i think that would be better
octopi




PostPosted: Sat Aug 23, 2003 7:37 pm   Post subject: (No subject)

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:
code:
<?=display_banner();?>


and also put somewhere at the top
code:
<? require_once "functions.php"; ?>



in your functions.php file you would put.


code:
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.
Sponsor
Sponsor
Sponsor
sponsor
Homer_simpson




PostPosted: Sun Aug 24, 2003 2:15 am   Post subject: (No subject)

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




PostPosted: Mon Aug 25, 2003 10:51 am   Post subject: (No subject)

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




PostPosted: Mon Aug 25, 2003 11:02 am   Post subject: (No subject)

o yea... nice pic of Kerry in your sig Homer 8)
Amailer




PostPosted: Mon Aug 25, 2003 11:24 am   Post subject: (No subject)

i just keepmy information in a mysql DB.
That way i can ezly edit delete and add Very Happy
Homer_simpson




PostPosted: Mon Aug 25, 2003 1:09 pm   Post subject: (No subject)

PaddyLong wrote:
o yea... nice pic of Kerry in your sig Homer 8)

THX Posted Image, might have been reduced in size. Click Image to view fullscreen.


PaddyLong wrote:
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

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 Sad so i gotto rewrite a lotta shit to change frames in to tables...
PaddyLong




PostPosted: Mon Aug 25, 2003 3:13 pm   Post subject: (No subject)

... that layout shouldn't take very long to write as a table....

code:

<table>
<tr>
<td colspan="2">banner</td>
</tr>

<tr>
<td>menu</td>
<td>body</td>
</tr>
</table>


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




PostPosted: Mon Aug 25, 2003 6:18 pm   Post subject: (No subject)

Quote:
Absolute positioning!!!!

tables cannot do anything to change absolute positioning...
Display posts from previous:   
   Index -> Programming, PHP -> PHP Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 2  [ 16 Posts ]
Goto page 1, 2  Next
Jump to:   


Style:  
Search: