Jump to content

Recommended Posts

Posted

This should be a simple question for anyone with an understanding of php, but the answer is eluding me... ;)

 

I am installing SMePoll, which is a really simple script for polling on a Web site. I'm all set up with it. The poll appears on a page called vote.php.

 

I want to place this poll on my index page. So how do I include the script located in a file called vote.php on my index page?

 

Obviously my index page needs to be a .php page. I do know that much :)

 

What line of php code do I use on my index page to call up vote.php and insert the content (i.e. polling box) into that place on my index page?

 

Any help would be appreciated!! :tchrocks:

Posted

Hello TOWebstress,

what you would need to do is use a include statement like this one

You would copy this line into your index.php file where you want the poll to appear.

Change where it says YOUR_PATH to the location of your vote file

if it is in a folder under the public_html folder

if not simple remove the YOUR_PATH/ from the line and you should be good to go

 

><?php include $_SERVER['DOCUMENT_ROOT']."YOUR_PATH/vote.php"; ?>

 

 

let us know if you need help

 

RobertM

Posted

Wow, you're fast! Thank you very much Robert!

 

I wasn't too far off in my attempts, actually. Your code did successfully link it, but I'm still having problems. The vote.php is dependent upon a couple other files (ip.txt and data.txt) and it can't seem to find those. It gives me lines of error that say:

 

Warning: file(ip.txt): failed to open stream: No such file or directory in /home/[myaccountname]/public_html/poll2/vote.php on line 35

 

Warning: Invalid argument supplied for foreach() in /home/[myaccountname]/public_html/poll2/vote.php on line 37

 

Warning: file(data.txt): failed to open stream: No such file or directory in /home/[myaccountname]/public_html/poll2/vote.php on line 67

 

Would it matter that the index page that I'm going to put this on is in a secured section of my site? That is, the index page is password-protected, but the polling script pages are not.

 

Thank you very much again!!!

Posted

TOWebstress,

can you send me the script via message if you do not want to post it here?

 

Also did you veryify that that path to those files are correct ?

 

and third if you can send a link that would help as well

 

 

RobertM

Posted

Hi :tchrocks:

 

You might also create an index.html page in an unprotected folder and try it to verify that the probem is the with the protected folder.

And if the poll can see the needed files.

This will tell you if the files need to be in the same folder or below it.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...