Beginner Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOtherBeginner Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #61  
Old February 21st, 2002, 11:00 PM
Decoder Decoder is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2002
Location: New Brunswick
Posts: 35 Decoder User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
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

Reply With Quote
  #62  
Old February 21st, 2002, 11:02 PM
bricker42 bricker42 is offline
Moderator =(8^(|)
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Feb 2002
Location: Sacramento, CA
Posts: 1,710 bricker42 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 m 38 sec
Reputation Power: 8
Send a message via AIM to bricker42
sure thing. good luck with your site. i'm off to read a book

Reply With Quote
  #63  
Old February 21st, 2002, 11:03 PM
bricker42 bricker42 is offline
Moderator =(8^(|)
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Feb 2002
Location: Sacramento, CA
Posts: 1,710 bricker42 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 m 38 sec
Reputation Power: 8
Send a message via AIM to bricker42
just put an include to news.php where you want it to show up on your page.

Reply With Quote
  #64  
Old February 21st, 2002, 11:08 PM
Decoder Decoder is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2002
Location: New Brunswick
Posts: 35 Decoder User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
can i have an include right under the one already there?

Reply With Quote
  #65  
Old February 21st, 2002, 11:11 PM
Decoder Decoder is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2002
Location: New Brunswick
Posts: 35 Decoder User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
hmm now i'm confused cause i want to have 1 box haveing links from "includes" and another one coming the dir "srt"

Reply With Quote
  #66  
Old February 21st, 2002, 11:11 PM
bricker42 bricker42 is offline
Moderator =(8^(|)
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Feb 2002
Location: Sacramento, CA
Posts: 1,710 bricker42 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 m 38 sec
Reputation Power: 8
Send a message via AIM to bricker42
as many includes as you like.

have a look at:

http://www.devshed.com/Server_Side/...01_1/page5.html

Reply With Quote
  #67  
Old February 21st, 2002, 11:19 PM
Decoder Decoder is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2002
Location: New Brunswick
Posts: 35 Decoder User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
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

Reply With Quote
  #68  
Old February 21st, 2002, 11:31 PM
bricker42 bricker42 is offline
Moderator =(8^(|)
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Feb 2002
Location: Sacramento, CA
Posts: 1,710 bricker42 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 m 38 sec
Reputation Power: 8
Send a message via AIM to bricker42
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 { }.

Reply With Quote
  #69  
Old February 22nd, 2002, 01:29 PM
Decoder Decoder is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2002
Location: New Brunswick
Posts: 35 Decoder User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
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)

Reply With Quote
  #70  
Old February 22nd, 2002, 01:34 PM
Decoder Decoder is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2002
Location: New Brunswick
Posts: 35 Decoder User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
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"); {
?>
<?
}
?>
"

Reply With Quote
  #71  
Old February 22nd, 2002, 01:57 PM
Decoder Decoder is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2002
Location: New Brunswick
Posts: 35 Decoder User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
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

Reply With Quote
  #72  
Old February 22nd, 2002, 09:02 PM
bricker42 bricker42 is offline
Moderator =(8^(|)
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Feb 2002
Location: Sacramento, CA
Posts: 1,710 bricker42 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 m 38 sec
Reputation Power: 8
Send a message via AIM to bricker42
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");

}
?>

Reply With Quote
  #73  
Old April 23rd, 2002, 03:44 PM
traffic_jammer traffic_jammer is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Posts: 6 traffic_jammer User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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.

Reply With Quote
Reply

Viewing: Dev Shed ForumsOtherBeginner Programming > including pages without SSI


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 |