| Coding Forum Problems with your code? Let's hear about it. |
06-04-2005, 02:15 PM
|
#1 (permalink)
|
|
Contributing Member
Join Date: 10-13-03
Location: Work, USA
Posts: 5,382
Latest Blog: None
|
Include
Is it possible to use the include code in a page that is already being included? It never works for me. How else could I include a file in a file that is being included?
|
|
|
06-04-2005, 02:27 PM
|
#2 (permalink)
|
|
v7n Mentor
Join Date: 10-13-03
Location: England.
Posts: 6,183
Latest Blog: None
|
why not include two seperate files or summat and place them?
|
|
|
06-04-2005, 03:21 PM
|
#3 (permalink)
|
|
Contributing Member
Join Date: 10-13-03
Location: Work, USA
Posts: 5,382
Latest Blog: None
|
It's a template system where a php file pulls another php file as a template, but I want to include in the template php file.
|
|
|
06-04-2005, 07:21 PM
|
#4 (permalink)
|
|
Inactive
Join Date: 06-20-04
Location: Ontario
Posts: 3,359
Latest Blog: None
|
Technically it is possile, but the problem is with the path resolution. Paths in php seems to resolve relative to the final html/php code displayed in the browser.
|
|
|
06-05-2005, 09:01 AM
|
#5 (permalink)
|
|
Contributing Member
Join Date: 10-13-03
Location: Work, USA
Posts: 5,382
Latest Blog: None
|
So what would I need to do?
|
|
|
06-06-2005, 05:25 AM
|
#6 (permalink)
|
|
No Longer Here
Join Date: 09-27-03
Location: State College, PA
Posts: 9,354
Latest Blog: None
|
You could use absolute URLs.
|
|
|
06-06-2005, 12:37 PM
|
#7 (permalink)
|
|
Contributing Member
Join Date: 10-13-03
Location: Work, USA
Posts: 5,382
Latest Blog: None
|
How would I do that?
|
|
|
06-06-2005, 05:11 PM
|
#8 (permalink)
|
|
No Longer Here
Join Date: 09-27-03
Location: State College, PA
Posts: 9,354
Latest Blog: None
|
Instead of this:
<?php include('filename.php'); ?>
Use this:
<?php include('http://www.sitename.com/filename.php'); ?>
I think that will work.
|
|
|
06-08-2005, 05:23 AM
|
#9 (permalink)
|
|
Contributing Member
Join Date: 03-06-04
Location: NY, CT, CA, AZ
Posts: 552
Latest Blog: None
|
Quote:
|
Originally Posted by Jazzee
Instead of this:
<?php include('filename.php'); ?>
Use this:
<?php include('http://www.sitename.com/filename.php'); ?>
I think that will work.
|
I'd also check for secure URIs...
Code:
<?php
if (isset($_SERVER['HTTPS'])) { // Check for secure URI.
include('https://www.sitename.com/filename.php');
} else {
include('http://www.sitename.com/filename.php');
}
?>
__________________
"90% of the game is half mental."
--Yogi Berra
Elizabeth Arden
|
|
|
06-08-2005, 03:37 PM
|
#10 (permalink)
|
|
No Longer Here
Join Date: 09-27-03
Location: State College, PA
Posts: 9,354
Latest Blog: None
|
What does that do?
|
|
|
06-12-2005, 11:44 AM
|
#11 (permalink)
|
|
Contributing Member
Join Date: 03-06-04
Location: NY, CT, CA, AZ
Posts: 552
Latest Blog: None
|
When using absolute paths for includes, always call from the correct absolute path (unsecured or secured).
The code I inserted checks if the current page is http: (unsecured) or https: (secured) and calls the include from from the correct path (either the unsecured absolute path or the secured absolute path).
Placing unsecured absolute paths into a secured page breaks the SSL on that page (if using IE, you'll see the lock with a red crack through it on the bottom right).
__________________
"90% of the game is half mental."
--Yogi Berra
Elizabeth Arden
|
|
|
06-12-2005, 11:46 AM
|
#12 (permalink)
|
|
Contributing Member
Join Date: 10-13-03
Location: Work, USA
Posts: 5,382
Latest Blog: None
|
Thanks!
|
|
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 07:47 PM.
© Copyright 2008 V7 Inc
|