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:
  #16  
Old February 21st, 2002, 08:32 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
here's a quick intro to using include()'s.

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

that series of articles is a good intro to php in general, too. it's what got me started.

Reply With Quote
  #17  
Old February 21st, 2002, 08:33 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 that makes since
so if i have 2 link boxes
and lets say i have 1 link in each box
box 1 link to gods page
box 2 link to devshed
how would i do this to have each link open in the main table????

Reply With Quote
  #18  
Old February 21st, 2002, 08:42 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
example:

directory listing:
index.php
god.php
other_guy.php
cannon_fodder.php
camper.php

you index.php file contains a list of links:
index.php?person=god
index.php?person=other_guy
index.php?person=cannon_fodder
index.php?person=camper

then, in the middle table you have:

<?
if ( $person ) {
include( $person . ".php" );
} else {
?>
<p>Please pick a person</p>
<?
}
?>

Reply With Quote
  #19  
Old February 21st, 2002, 08:52 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 but it is my links.php
that will have the links
and i am including that into the index.php

Reply With Quote
  #20  
Old February 21st, 2002, 08:57 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
that works. just make sure that the path in your include is from the location of your links.php file and not the location of your index.php file, assuming they're in different directories. if it's the same directory, then it's taken care of.

Reply With Quote
  #21  
Old February 21st, 2002, 09: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 well i typed this
into my middle table
"<?include();?>"
in my new.php
and then i included my links.php in a box on the left
"<a href="<?=$PHP_SELF?>?person=SRT.God">SRT.God</a> "
but i get a parse error on my new.php on line 90
line 90=<?include();?>
what can i do to fix?
or what am i doing wrong???

Reply With Quote
  #22  
Old February 21st, 2002, 09:17 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
instead of <?include();?> you need <?include( $person . ".php" );?>

play with the format of the include so that the value you put in $person is the location of the file you want to include.

Reply With Quote
  #23  
Old February 21st, 2002, 09: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
how can i change that
what if i want to generalise it
so i can just copy/paste everywhers
like instead of $person type $page or $link???
now how would my URL tags look like???
or do i keep them the same?

Reply With Quote
  #24  
Old February 21st, 2002, 09:27 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 change the include to

"<?include( $link . ".php" );?> "
from
"<?include( $person . ".php" );?> "

and my link says this
"<a href="<?=$PHP_SELF?>?link=SRT.God">SRT.God</a>"
but i am still getting this parse error on line 90
which is the "<?include( $person . ".php" );?> "

Reply With Quote
  #25  
Old February 21st, 2002, 09:37 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
try:

<?include ( $HTTP_GET_VARS["person"] . ".php" ) ?>

Reply With Quote
  #26  
Old February 21st, 2002, 09:39 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
www.decodethis.com/new.php
is the file i am going to make my index.php
when i'm done
and www.decodethis.com/includes/ is the dir where my links.php is
maybe you can tell what i'm doing wrong

Reply With Quote
  #27  
Old February 21st, 2002, 09:46 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
you pass variables through you link with http://some_page.html?variable_name...ariable_value_3

then you access those values in your php script as $variable_name_1, $variable_name_2, etc...

or, since it looks like register_globals might be disabled, you get at the variables through the $HTTP_GET_VARS[] array. so: $HTTP_GET_VARS["variable_name_1"], etc.

you can put anything you want in your query string, although there is a total limit to the length of the url (it's pretty big). just be sure that whatever you put in there is url encoded (+ instead of a space, stuff like that). you can use the urlencode() function to encode a string into a url, and urlunencode() to get it back.

Reply With Quote
  #28  
Old February 21st, 2002, 09:49 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
you just completly lost me
well my link opens a new window now
but it still gives me an error now

Reply With Quote
  #29  
Old February 21st, 2002, 09:50 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
can you put your php file up as a text file? that way i could look at your code.

Reply With Quote
  #30  
Old February 21st, 2002, 09:51 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
i cant figure out how to get my links to open properly
since they are in a different dir
i tried
/srt/god.html
but that is still giving me the error

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