TinyPortal

Development => Feedback => Bugs/Errors => Topic started by: sanax on November 15, 2006, 07:35:27 AM

Title: php parse error in php block (poll)
Post by: sanax on November 15, 2006, 07:35:27 AM
I'm trying to insert an 'include' in a phpbox (I'm just experimenting cuz I'm new to php)

I included the following:
<?php

include('http://theartgangster.com/aok-forum/pollscript/');

?>


but get a parse error:
Parse error: parse error, unexpected '<' in /home/gangster/public_html/aok-forum/Sources/Load.php(1711) : eval()'d code(35) : eval()'d code on line 1

...the URL is visible in a browser though but why not in the block?

(Don't know if this is the right forum to post this in - Move if necessary)
Title: Re: php parse error in php block (poll)
Post by: G6Cad on November 15, 2006, 08:05:39 AM
remove the PhP tags

<?php  ?>
Title: Re: php parse error in php block (poll)
Post by: sanax on November 15, 2006, 08:43:49 AM
Thank you G6! Works great! Now my next problem and I hope you can help me with that...

If I've voted it redirect me to the index.php in the script:
http://theartgangster.com/aok-forum/pollscript/index.php

... is there a way that I can get the result (above page) show in the block itself and not in a seperate new window?
Title: Re: php parse error in php block (poll)
Post by: sanax on November 15, 2006, 08:52:30 AM
I found this but how can I change the code to php?

In order to get back after voting to the site where the vote is included, you need to put a hidden form field into the HTML template:

<input type="hidden" name="vote_redirect" value="http://www.your-server.com/seite.shtml" />
Title: Re: php parse error in php block (poll)
Post by: akulion on November 15, 2006, 08:53:55 AM
just echo it out like this

echo '
code here
';

just make sure u dont use any ' (single quotes) inside the code
Title: Re: php parse error in php block (poll)
Post by: sanax on November 15, 2006, 09:01:36 AM
Aku... you mean like this?

echo '
<input type="hidden" name="vote_redirect" value="http://theartgangster.com/aok-forum/pollscript/index.php" />
';


???
I tried the above but it still redirects me to a new browser window
Title: Re: php parse error in php block (poll)
Post by: akulion on November 15, 2006, 09:06:44 AM
oh for the new browser u cant really do much except try using an iframe really so it changes when someone votes
Title: Re: php parse error in php block (poll)
Post by: sanax on November 15, 2006, 09:11:36 AM
In the documentation of the script I found this but when I use a html box it gives me a permission error...

QuoteWith the HTML tag <iframe> you can include the script in an existing page. Place the <iframe> tag where you want it to appear within the page: Example:

<iframe name="voting" src="./voting.php" width="400" height="300" frameborder="0"></iframe>

Maybe I can use the above? I'm trying to figure this out and maybe we can use it as a snippet because I saw there is a need for a vote by guests
Title: Re: php parse error in php block (poll)
Post by: akulion on November 15, 2006, 09:13:53 AM
well the code is already given in ur post above for the iframe

but u will probably have to use it as a center block since the poll is pretty huge in dimensions width wise
Title: Re: php parse error in php block (poll)
Post by: sanax on November 15, 2006, 09:18:07 AM
It seems to me I'm not allowed to use this <iframe> code in the blocks?! I get this error when using a html box:

QuoteForbidden
You don't have permission to access /aok-forum/index.php on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.


--------------------------------------------------------------------------------

Apache/1.3.36 Server at www.theartgangster.com Port 80

Here is the URL of the error: http://theartgangster.com/aok-forum/index.php?action=tpadmin
Title: Re: php parse error in php block (poll)
Post by: akulion on November 15, 2006, 09:48:09 AM
Iframes work perfectly in a html or script box

but I dont know why you cannot access a file on your own server through it - strange
Title: Re: php parse error in php block (poll)
Post by: sanax on November 15, 2006, 10:45:02 AM
I think I'll have to contact my hosting server. iframe is a standard feature of SMF and TP or do I need an extra mod to show iframes? Thanks for all the help Aku... hope I can get it to work! :)
Title: Re: php parse error in php block (poll)
Post by: akulion on November 15, 2006, 10:47:25 AM
well post your exact iframe code its nothing special really in fact even smf admin panel uses iframes (where u get the news)

so its probably an error in ur code somewhere
Title: Re: php parse error in php block (poll)
Post by: sanax on November 16, 2006, 12:41:07 AM
Thank you, I eventually sorted it out! :) Guests are now able to vote. IP's and cookies prevent them from voting twice. You can set it as you want. Thanks for the help.