Author |
Message |
11/03/2002 07:33:05
|
Muse
Beginner
Joined: 03/03/2002 09:38:04
Messages: 8
Location: Orlando, FL
Offline
|
Well, the solution is very simple actually.
The page in which your poll is embedded MUST be named with the .php extension, or the poll will not work.
Then, all you have to do to get another page included is to add a tag like this one, on that page. Place the tag where you want the included page to load:
<?php
include("myfolder/myfile.txt");
?>
The home page of my site has both a poll and an included file... and everything works great.
Good Luck.
|
Muse
It only takes a drop of ink to make a million people think. ~ unknown
http://www.museium.net |
|
15/03/2002 22:00:38
|
Muse
Beginner
Joined: 03/03/2002 09:38:04
Messages: 8
Location: Orlando, FL
Offline
|
*bump*
|
Muse
It only takes a drop of ink to make a million people think. ~ unknown
http://www.museium.net |
|
15/03/2002 22:11:20
|
Muse
Beginner
Joined: 03/03/2002 09:38:04
Messages: 8
Location: Orlando, FL
Offline
|
But let's say you place a poll on a page called: poll.php and then you want to include that poll.php file on another page... like your index page.
Well, the way to do it is to simply to place this tag somewhere on your index page:
<?php
include("myfolder/poll.php");
?>
Then, you must also save your index page with the .php extension.
|
Muse
It only takes a drop of ink to make a million people think. ~ unknown
http://www.museium.net |
|
15/03/2002 22:38:15
|
Anonymous
|
the page where I am embeding de poll must be .php or .php3?
Does it matters?
thank you
|
|
16/03/2002 02:02:48
|
Muse
Beginner
Joined: 03/03/2002 09:38:04
Messages: 8
Location: Orlando, FL
Offline
|
It shouldn't matter... as long as your server is running php3 or higher.
|
Muse
It only takes a drop of ink to make a million people think. ~ unknown
http://www.museium.net |
|
16/03/2002 06:15:10
|
Anonymous
|
Thanks Muse, but I want to run the poll through SSI - which means I want the poll on each page of my site.
I cannot rename each page php, as they all end .shtml
Do you have any suggestions ?
|
|
16/03/2002 09:26:31
|
Muse
Beginner
Joined: 03/03/2002 09:38:04
Messages: 8
Location: Orlando, FL
Offline
|
If I understand you correctly, you are saying you want to put a poll on a page, and then have that poll page included on every other page of your website.
I hope I got that right.
Well, then the only way that I know how to do that would be to save your poll page as a .php file (for example: poll.php) and then on each page that you want the poll to appear, to place a php include tag (instead of ssi) like so:
<?php
include("myfolder/poll.php");
?>
You then, however, must rename every page you include your poll on with a .php file extension.
Personally, I don't know why anyone would want to use SSI to include a file when (in my opinion) using a php include tag is so much easier.
I am using php include tags for all the includes across my site. You just have to remember any page that contains php code(even if it is just one simple include tag) must be named with the .php extension.
Basically, what happens when a user requests a file from the server through their browser is this:
The server looks to see what the extension is on the file so it knows how it should handle the file. If the server sees a .shtml extension, it automatically knows to look for an incude on that page; it finds the path to the included file and then loads that file inside the requested document before sending it to the user’s browser. Some servers are configured to examine all files to see if they contain server-side includes; while most servers are configured to examine only files with a particular file extension, such as .shtml, .shtm, or .inc.
This holds true for php code and extensions. If a file containing php code is not saved with the .php extension the server will not bother to read the document and therefore not process the php code contained within it. The .php extension is like a big red flag waving around and saying to the server, “Hey, I got some stuff in here I need you to do, come take a look.” Without the extension, the server will simply ignore the file and send it to the browser as is.
For this reason, ssi and php do not work well together (at least in my humble non-expert opinion anyway) because each is dependant their file having their designated extension. And to my knowledge, you can’t put two extensions on one file. The solution to this is to simply use php include tags instead of server-side-includes.
You will find that php has far reaching possibilities, including the ability to easily include files inside of other files… while on the other hand, ssi is limited to only including files.
Obviously, it is your choice as to which method you want to use for the includes on your site; however, as far as I know the only method that is going to work with the Advanced Poll is to use php include tags and name all your files .php.
Again, I must emphasize that I am not an expert by any stretch of the imagination. I am just speaking from my own personal experience and research. I really hope this helps in some way.
|
Muse
It only takes a drop of ink to make a million people think. ~ unknown
http://www.museium.net |
|
18/03/2002 12:53:50
|
Anonymous
|
Thanks Muse, that did answer my question but as I am almost finished with my redesign I do not want to have to go back and change everything to .php
I was rather hoping that I would not have to do that and still use the poll, but it does not look like it.
|
|
|