|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#61
|
|||
|
|||
|
ok now is there away to set the basic page that it loads with
say i have a news.php and everytime i open new.php i want the main box to have that in it |
|
#62
|
|||
|
|||
|
sure thing. good luck with your site. i'm off to read a book
![]() |
|
#63
|
|||
|
|||
|
just put an include to news.php where you want it to show up on your page.
|
|
#64
|
|||
|
|||
|
can i have an include right under the one already there?
|
|
#65
|
|||
|
|||
|
hmm now i'm confused cause i want to have 1 box haveing links from "includes" and another one coming the dir "srt"
|
|
#66
|
|||
|
|||
|
|
|
#67
|
|||
|
|||
|
hmm i noticed this
"<? if ( $link ) { include( "includes/" . $link ); include( "srt/" . $link ); } else { ?> <? } ?> " waht are the xtra "<? } ?>" for??? i know when i take them out i get a white page with errors |
|
#68
|
|||
|
|||
|
an if statement looks like this:
if (some condition is true) { do something; } otherwise { do something else; } but instead of "do something else;" you want to print some html, and the easiest way to that is to exit the php code with "?>", type the html code, then go back into php code with "<?" to put in the last "}". keep in mind that anything in the if statement will only be executed if $link is set, so the first time someone visits the page they're not going to see any includes you put there. if you want something to be included always, but it outside of the { }. |
|
#69
|
|||
|
|||
|
how do i setup a link that is not in the includes dir????
i mean if it is in my root dir (/chatroom) instead of (/includes/chatroom) |
|
#70
|
|||
|
|||
|
ok well i tried ti include my news automatically
and it works as soon as i load the page but as soon as i click on a link it opens it and then includes my news right under neith it " <? if ( $link ) { include( "includes/" . $link ); } include("fsnews.php"); { ?> <? } ?> " |
|
#71
|
|||
|
|||
|
wahoo
ok i figured out how do get stuff working from anywheres after some fiddling around "<? if ( $link ) { include( "/home/sites/site138/web/" . $link ); } { ?> <? } ?>" hehe yahoo for absolute pathes now i just need to get my news script included, in the new.php instead of including it into every link i open |
|
#72
|
|||
|
|||
|
congrats. you've probably fixed it by now, but for your news.php file do something like:
<? if ( $link ) { include( "/home/sites/site138/web/" . $link ); } else { include("fsnews.php"); } ?> |
|
#73
|
|||
|
|||
|
I use uncludes all the time. Both in a Mac environment (www.dailyheraldtribune.com) using lasso (which is sorta like PHP. And now recently in PHP).
When I build a site I create one HTML file in Dreamweaver for the design template. In the middle of the template I have a table where all my content for whatever page will go. Then what I do is I mark in the table an xxx. Then I open that page in a text editor and I copy all the HTML prior to the xxx and paste it into a file called pre.php and then I copy all the HTML after the xxx into a file called post.php Of course I have to insert the path's so PHP doesn't complain. So I also create a common.php file where I define the variable $pre and $post This make pages it all pretty simple. Let's say I am going to create the index page, It (as other pages) would look like this: ************************ <?PHP include("common.php") ?> <?PHP require ($pre); ?> All my content for the index would then go in here..... I use HTML, additional PHP for displaying things like date. Forms, whatever would go in another dynamic page. I just build the content in dreamweaver and then I remove the header </ footer tags and copy my HTML into here and the page is done. <?PHP require ($post); ?> ************************ common.php would just look like this: <? $pre = "/home/traffic/public_html/test/pre.php"; $post = "/home/traffic/public_html/test/post.php"; ?> I then put all my other variables in here to like database connections, contact form variables and whatever. Then if I have made a typo or want to add or take somethign away, I just open the pre or post file and edit it . Makes life a lot simpler (for me anyway) ![]() Last edited by traffic_jammer : April 23rd, 2002 at 03:47 PM. |
![]() |
| Viewing: Dev Shed Forums > Other > Beginner Programming > including pages without SSI |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|