vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Unknown Error in index.php Code (https://vborg.vbsupport.ru/showthread.php?t=191621)

legionofangels 09-23-2008 12:42 AM

Unknown Error in index.php Code
 
Unable to add cookies, header already sent.
File: /homepages/26/d196297218/htdocs/index.php
Line: 8



Search Engine Friendly URLs by vBSEO 3.2.0

Viewable:

http://www.legionofangels.net

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

Solutions, thoughts, ideas?

Dismounted 09-23-2008 05:33 AM

Make sure there is no whitespace before the <?php tag in index.php & config.php.

legionofangels 09-25-2008 03:40 AM

I don't get this at all the code looks and works fine now on Firefox, but not on IE 7 or Safari 3.2 or whatever I have.

The original code maker of which it works on his own website installed it tonight.

I'm lost.

Lynne 09-25-2008 04:03 AM

What is line 8 on your php page? (I get the error in both firefox and safari on my mac.)

legionofangels 09-25-2008 01:54 PM

Quote:

Originally Posted by Lynne (Post 1629743)
What is line 8 on your php page? (I get the error in both firefox and safari on my mac.)

So do I, now I get it on all of the 3 browsers.

Line 8 is our Meta Tag or Meta Description.

Lynne 09-25-2008 02:06 PM

Very strange. I'm not sure what else to suggest. Whenever I've heard this error brought up, it is because of either an extra space around the php tags or because part of the header is parsed prematurely (I can't remember if that was also because of the extra space). I guess I would start over with writing the index page. Start a new one and slowly add in parts of the code until you get the error.

Dismounted 09-25-2008 02:14 PM

It's caused when you run a script that adds cookies AFTER content has been sent to the browser. White-space is content, BTW.

legionofangels 09-25-2008 03:06 PM

PHP Code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Legion of Angels</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<meta name="DESCRIPTION" content="Christian Forums giving support for those that suffer.  Religious topics on God, Jesus, Angels, and Christianity.  Blog, Chat, Shop, Radio, and Games."/>
<meta name="keywords" content="legion angels angel God Jesus forum holy cross loa help support community christian"/>
<meta name="revisit-after" content="1 days"/>
<meta http-equiv="expires" content="0"/>
<meta http-equiv="Pragma" content="no-cache"/>
<meta name="verify-v1" content="oQNUsM2RG3V0W1d/KOKC9i0Jgj95r8sOovqns92Gr5E=" />
<meta name="y_key" content="5e56751b612a68ab" />
<meta name="msvalidate.01" content="B110302C8028471D8171F5520FF19ED1" />

<link rel="stylesheet" type="text/css" href="loamain.css" />
</head>
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-1728006-1";
urchinTracker();
</script>
<body>


<div id="frame">

    <dl id="imap">
    <dd><a id="about" title="About This Site" href="shop.htm">About</a></dd>
    <dd><a id="messages" title="Angel Message Archive" href="http://www.legionofangels.net/angelarchive.php">Messages</a></dd>
    <dd><a id="home" title="Home" href="http://www.legionofangels.net">Home</a></dd>
    <dd><a id="forum" title="Forum" href="http://www.legionofangels.net/forum/">Forum</a></dd>
    <dd><a id="news" title="News" href="http://www.legionofangels.net/wpnews/" target="_blank">News</a></dd>
    <dd><a id="bible" title="Bible" href="http://www.biblegateway.com" target="_blank">Bible</a></dd>
    <dd><a id="google" title="Google" href="http://www.google.com" target="_blank">Google</a></dd>
    <dd><a id="church" title="Church" href="http://www.thechurchfinder.com/home.asp" target="_blank">Church</a></dd>
    <dd><a id="weather" title="Weather" href="http://www.weather.com/" target="_blank">Weather</a></dd>
    <dd><a id="shop" title="Shop" href="shop.htm" target="_parent">Shop</a></dd>
    </dl>


    <div id="contentheader"></div>
    <div id="contentheader2">
        <div id="verse">
            <div id="jverse">
<script type="text/javascript" language="JavaScript" src="http://www.biblegateway.com/usage/votd/votd2html.php?version=31&amp;jscript=1"> 
</script>
<!-- alternative for no javascript -->
<noscript>
<a href="http://www.biblegateway.com/usage/votd/votd2html.php?version=31&amp;jscript=0">View Verse of the Day</a> 
</noscript>
            </div>
        </div>
    </div>
    <div id="loa03"></div>
    <div id="loa04"></div>
    <div id="loa05"></div>
    <div id="loa06"></div>
    <div id="centerbox">
        <div id="blog"><?php include('http://www.legionofangels.net/gm'); ?></div></div>
    <div id="loa08"></div>

    <div id="loa09">
        <div id="site1" class="cleargif"><a href="http://www.legionofangels.net/forum/forumdisplay.php?f=6" title="Entertainment"></a></div>
        <div class="content" id="conleft">
<script language="JavaScript" src="http://feed2js.org//feed2js.php?src=http%3A%2F%2Frss.cnn.com%2Frss%2Fcnn_showbiz.rss&amp;chan=title&amp;num=7&amp;desc=1" type="text/javascript"></script>
        </div>
    </div>


    <div id="loa10">
        <div id="site2"><a href="http://www.legionofangels.net/forum/forumdisplay.php?f=15" title="Religion"></a></div>
        <div class="content" id="conmid">
<script language="JavaScript" src="http://feed2js.org//feed2js.php?src=http%3A%2F%2Fwww.goarticles.com%2Fcgi-bin%2Frss-search.cgi%3F%26l%3D20%26s%3D1%26c%3D43%26D1%3Dsubject%26title%3DReligion&amp;chan=title&amp;num=7&amp;desc=1" type="text/javascript"></script>
        </div>

    </div>


    <div id="loa11">
        <div id="site3"><a href="http://www.legionofangels.net/forum/forumdisplay.php?f=37" title="Technology"></a></div>
        <div class="content" id="conright">
<script language="JavaScript" src="http://feed2js.org//feed2js.php?src=http%3A%2F%2Frss.cnn.com%2Frss%2Fcnn_tech.rss&amp;chan=title&amp;num=7&amp;desc=1" type="text/javascript"></script>

        </div>


    </div>

<div id="loa12">

<div class="content" style="position:relative;float:left;background-color:white;left:33px;">
<?php include("usage.php"); ?>
</div>



<div class="content" style="position:relative;float:left;background-color:white;left:71px;">
<?php include("mypoll.php"); ?>
</div>


<div class="content" style="position:relative;float:left;background-color:white;left:111px;">
test
</div>


<!-- AddThis Bookmark Button BEGIN -->
<div id="bookmark">
<a href="http://www.addthis.com/bookmark.php" onclick="addthis_url   = location.href; addthis_title = document.title; return addthis_click(this);" target="_blank"><img src="http://s9.addthis.com/button1-bm.gif" width="125" height="16" border="0" alt="AddThis Social Bookmark Button" /></a> <script type="text/javascript">var addthis_pub = 'legionofangels';</script><script type="text/javascript" src="http://s9.addthis.com/js/widget.php?v=10"></script>  
</div>
<!-- AddThis Bookmark Button END -->
</div>
<br clear="all" /><!-- without this little <br /> NS6 and IE5PC do not stretch the frame div down to encopass the content DIVs -->

</div>





</body>
</html>

That is our index.php page.

Lynne 09-25-2008 03:11 PM

I don't get the error when testing it on my site. Try copying the code from here into a new page and test it.

Also, you may want to correct this line (//feed2.js is incorrect):
HTML Code:

<script language="JavaScript" src="http://feed2js.org//feed2js.php?src=http%3A%2F%2Frss.cnn.com%2Frss%2Fcnn_showbiz.rss&amp;chan=title&amp;num=7&amp;desc=1" type="text/javascript"></script>

legionofangels 09-25-2008 03:16 PM

Quote:

Originally Posted by Lynne (Post 1630111)
I don't get the error when testing it on my site. Try copying the code from here into a new page and test it.

http://legionofangels.net/index2.php

It errored again.

The lower right white box is gone again though.

Lynne 09-25-2008 03:24 PM

Ah ha! This is where you are going wrong:
<?php include("mypoll.php"); ?>
(I think that's the one.)

Look at what it spits out. It starts with an <html> tag again (and another <head> and <body> tag)

legionofangels 09-25-2008 03:30 PM

PHP Code:

<?php

//uncomment this and then change the directory if this is above your forums directory
//chdir('./forums');
require_once ('./global.php');

require_once (
'./includes/functions_bigthree.php');
require_once (
'./includes/functions_misc.php');
require_once (
'./includes/class_bbcode.php');

$poll mypoll();
echo 
$poll;


function 
mypoll()
{
    global 
$vbulletin$stylevar$vbphrase;
    
$query = array();
    
$query['orderby'] = 'poll.dateline';
    
$query['sortorder'] = 'DESC';
    
$pollforumids1 = array(16,17,18,19,20,21,23,24,25,26,28,29,30,31,32,2,3,4,5,7,8,9,10,12,13,14,34,35,36,37,40,54,198,153,200);
    
$pollforumids = array();
    foreach (
$pollforumids1 as $key => $pollforumid)
    {
        
$pollforumids[$key] = trim($pollforumid);
    }
    
$mods['inforums'] = 'AND thread.forumid IN(' implode(','$pollforumids) . ')';
    if (
$vbulletin->userinfo['userid'])
    {
        
$query['pollfields'] = ', voteoption';
        
$query['polljoin'] = 'LEFT JOIN ' TABLE_PREFIX .
            
'pollvote AS pollvote ON (pollvote.pollid = poll.pollid AND pollvote.userid = ' .
            
$vbulletin->userinfo['userid'] . ')';
    }
    
$pollinfo $vbulletin->db->query_first("
        SELECT thread.pollid, open, threadid, replycount, forumid, question, poll.dateline, options, votes, active, numberoptions, timeout, multiple, voters, public 
$query[pollfields]
        FROM " 
TABLE_PREFIX "poll AS poll
        INNER JOIN " 
TABLE_PREFIX "thread AS thread USING (pollid)
        
$query[polljoin]
        WHERE open <> 10 
        AND visible = 1 
        AND active = 1
        
$mods[inforums]
        ORDER BY 
$query[orderby] $query[sortorder]
    "
);
    if (
$pollinfo['pollid'])
    {
        
$bbcode_parser = &new vB_BbCodeParser($vbulletinfetch_tag_list());
        
$pollinfo['question'] = $bbcode_parser->parse($pollinfo['question'], 'nonforum'true);

        
$splitoptions explode('|||'$pollinfo['options']);
        
$splitvotes explode('|||'$pollinfo['votes']);

        
$pollinfo['nvotes'] = iif($pollinfo['multiple'], $pollinfo['voters'], array_sum
            
($splitvotes));

        
$pollforumperms fetch_permissions($pollinfo['forumid']);

        if (!
$pollinfo['active'] or !$pollinfo['open'] or ($pollinfo['dateline'] + ($pollinfo['timeout'] *
            
86400) < TIMENOW and $pollinfo['timeout']) or !($pollforumperms $vbulletin->bf_ugp_forumpermissions['canvote']))
        {
            
$pollinfo['showresults'] = 1;

            
$pollinfo['message'] = iif(($pollforumperms $vbulletin->bf_ugp_forumpermissions['canvote']),
                
$vbphrase['this_poll_is_closed'], $vbphrase['you_may_not_vote_on_this_poll']);
        }

        if (
fetch_bbarray_cookie('poll_voted'$pollinfo['pollid']) or $pollinfo['voteoption'])
        {
            
$pollinfo['showresults'] = 1;
            
$pollinfo['message'] = $vbphrase['you_have_already_voted_on_this_poll'];
        }

        if (
can_moderate($pollinfo['forumid'], 'caneditpoll'))
        {
            
$show['editpoll'] = true;
        }

        
$pollbits '';
        
$option '';
        foreach (
$splitvotes as $key => $value)
        {
            
$option['question'] = $bbcode_parser->parse($splitoptions["$key"], ''$mod_options['portal_poll_allowsmilies']);
            
$show['voteital'] = '';

            if (
$pollinfo['voteoption'] == ($key 1))
            {
                
$show['voteital'] = 1;
            }

            
$option['votes'] = $value;
            
$option['number'] = $key 1;

            if (
$pollinfo['showresults'])
            {
                
$option['percent'] = 0;
                if (
$value)
                {
                    
$option['percent'] = vb_number_format($value $pollinfo['nvotes'] * 1002);
                }

                
$option['graphicnumber'] = $option['number'] % 1;
                
$option['barnumber'] = intval($option['percent'] * 1.4);

                eval(
'$pollbits .= "' fetch_template('adv_portal_pollresult') . '";');
            } elseif (
$pollinfo['multiple'])
            {
                eval(
'$pollbits .= "' fetch_template('adv_portal_polloption_multiple') . '";');
            }
            else
            {
                eval(
'$pollbits .= "' fetch_template('adv_portal_polloption') . '";');
            }
        }
        
//eval('$polltotal .= "' . fetch_template('adv_portal_poll') . '";');
        
$polltotal .= "<form method=\"post\" action=\"./poll.php\">";
        
$polltotal .= "<table>";
        
$polltotal .= "<tr>";
        
$polltotal .= "<td class=\"thead\">" $pollinfo['question'] . "</td>";
        
$polltotal .= "</tr>";
        
$polltotal .= $pollbits;
        
$polltotal .= "<tr>";
        
$polltotal .= "<td align=\"" $stylevar['left'] . "\" class=\"alt1\">";
        if (
$pollinfo['showresults'])
        {
            
$polltotal .= "<span class=\"smallfont\"><b>" $vbphrase['votes'] . ": " $pollinfo['nvotes'] .
                
"</b><br />" $pollinfo['message'] . ".</span>";
        }
        else
        {
            
$polltotal .= "<input name=\"s\" type=\"hidden\" value=\"" $vbulletin->session->vars['dbsessionhash'] .
                
"\" />";
            
$polltotal .= "<input name=\"do\" type=\"hidden\" value=\"pollvote\" />";
            
$polltotal .= "<input type=\"hidden\" name=\"securitytoken\" value=\"" $vbulletin->userinfo['securitytoken'] .
                
"\" />\n";
            
$polltotal .= "<input name=\"pollid\" type=\"hidden\" value=\"" $pollinfo['pollid'] .
                
"\" />";
            
$polltotal .= "<input class=\"button\" name=\"button\" type=\"submit\" value=\"" .
                
$vbphrase['vote_now'] . "\" />";
        }
        
$polltotal .= "</td>";
        
$polltotal .= "</tr>";
        
$polltotal .= "<tr>";
        
$polltotal .= "<td class=\"alt2\">";
        
$polltotal .= "<div class=\"smallfont\">&raquo; <a href=\"" $vbulletin->options['bburl'] .
            
"/poll.php?" $vbulletin->session->vars['sessionurl'] .
            
"do=showresults&amp;pollid=" $pollinfo['pollid'] . "\">" $vbphrase['view_poll_results'] .
            
"</a></div>";
        if (
$mod_options['portal_poll_allowreplies'])
        {
            
$polltotal .= "<div class=\"smallfont\">&raquo; <a href=\"" $vbulletin->options['bburl'] .
                
"/newreply.php?" $vbulletin->session->vars['sessionurl'] . "t=" $pollinfo['threadid'] .
                
"\">" $vbphrase['discuss_this_poll'] . "</a></div>";
            
$polltotal .= "<div class=\"smallfont\">&raquo; <a href=\"" $vbulletin->options['bburl'] .
                
"/showthread.php?" $vbulletin->session['sessionurl'] . "t=" $pollinfo['threadid'] .
                
"\">" $vbphrase['this_poll_has'] . " " $pollinfo['replycount'];
            if (
$pollinfo['replycount'] == 1)
            {
                
$polltotal .= $vbphrase['reply'];
            }
            else
            {
                
$polltotal .= $vbphrase['replies'];
            }
            
$polltotal .= "</a></div>";
        }

        if (
$show['editpoll'])
        {
            
$polltotal .= "<div class=\"smallfont\">&raquo; <a href=\"" $vbulletin->options['bburl'] .
                
"/poll.php?" $vbulletin->session->vars['sessionurl'] .
                
"do=polledit&amp;pollid=" $pollinfo['pollid'] . "\">" $vbphrase['edit_poll'] .
                
"</a></div>";
        }
        
$polltotal .= "</td>";
        
$polltotal .= "</tr>";
        
$polltotal .= "</table>";
        
$polltotal .= "</form>";
        return 
$polltotal;

    }
}

?>

There is the mypoll.php, what should we modify?

Thanks for your help so far, but we're still not seeing what the problem is.

Lynne 09-25-2008 03:39 PM

What do the templates look like - adv_portal_pollresult, etc.? Do they start with the <html> tag?


To see the problem, view your page source right after you spit out the showthread pages and you'll see this:
HTML Code:

<div class="content" style="position:relative;float:left;background-color:white;left:71px;">

<html dir="" lang="">
<head>


        <title>Legion of Angels Forums</title>

</head>
<body>


<br /><br /><br />


<table class="tborder" cellpadding="" cellspacing="" border="0" width="70%" align="center">
<tr>
        <td class="tcat"></td>
</tr>
<tr>
        <td class="panelsurround" align="center">
        <div class="panel">
                <div align="">
       
                               
                        <!-- main error message -->
                       
                       
                        <div style="margin: 10px">Unable to add cookies, header already sent.<br />
File: /homepages/26/d196297218/htdocs/index2.php<br />
Line: 8<br /></div>
                       
                               
                        <!-- / main error message -->

Notice how you've got a whole page 'started' again in the middle of your page.

legionofangels 09-25-2008 03:44 PM

This is one of his templates:

adv_portal_polloption_multiple

HTML Code:

<tr>
<td class="$bgclass"><label for="pollchoice_$option[number]"><input id="pollchoice_$option[number]" name="optionnumber[$option[number]]" type="checkbox" value="yes" /> <span class="smallfont">$option[question]</span></label></td>
</tr>

--------------- Added [DATE]1222361256[/DATE] at [TIME]1222361256[/TIME] ---------------

I got a pm from someone on this, what if we put that code in the middle box in an iframe, will that fix the error?

It'll make that one section of the front page no content, but there will be a ton of other content in divs anyway.

--------------- Added [DATE]1222361393[/DATE] at [TIME]1222361393[/TIME] ---------------

This is:

adv_portal_poll

HTML Code:

<tr>
        <td class="thead">$pollinfo[question]</td>
</tr>

$pollbits

<tr>
        <td align="$stylevar[left]" class="$altbgclass">
                <if condition="$pollinfo['showresults']">
                        <span class="smallfont"><b>$vbphrase[total_votes]: $pollinfo[nvotes]</b><br />$pollinfo[message].</span>
                <else />
                        <input name="s" type="hidden" value="$session[dbsessionhash]" />
        <input type="hidden" name="securitytoken" value="$bbuserinfo[securitytoken]" />
                        <input name="do" type="hidden" value="pollvote" />
                        <input name="pollid" type="hidden" value="$pollinfo[pollid]" />
                        <input class="button" name="button" type="submit" value="$vbphrase[vote_now]" />
                </if>
        </td>
</tr>
<tr>
        <td class="$bgclass">
                <div class="smallfont">&raquo; <a href="$vboptions[bburl]/poll.php?$session[sessionurl]do=showresults&amp;pollid=$pollinfo[pollid]">$vbphrase[view_poll_results]</a></div>
                <if condition="$mod_options['portal_poll_allowreplies']">
                        <div class="smallfont">&raquo; <a href="$vboptions[bburl]/newreply.php?$session[sessionurl]t=$pollinfo[threadid]">$vbphrase[discuss_this_poll]</a></div>
                        <div class="smallfont">&raquo; <a href="$vboptions[bburl]/showthread.php?$sddession[sessionurl]t=$pollinfo[threadid]">$vbphrase[this_poll_has] $pollinfo[replycount] <if condition="$pollinfo['replycount'] == 1">$vbphrase[reply]<else />$vbphrase[replies]</if></a></div>
                </if>

                <if condition="$show['editpoll']">
                        <div class="smallfont">&raquo; <a href="$vboptions[bburl]/poll.php?$session[sessionurl]do=polledit&amp;pollid=$pollinfo[pollid]">$vbphrase[edit_poll]</a></div>
                </if>
        </td>
</tr>

--------------- Added [DATE]1222361502[/DATE] at [TIME]1222361502[/TIME] ---------------

This is:

adv_portal_polloption

HTML Code:

<tr>
        <td class="$bgclass" valign="middle"><label for="pollchoice_$option[number]"><input id="pollchoice_$option[number]" name="optionnumber" type="radio" value="$option[number]" /><span class="smallfont">$option[question]</span></label></td>
</tr>


Tact7626 09-25-2008 03:52 PM

i can't find the culprits within the guys poll files/code. i thought he would have "echo:html"

the only echo's i see are

echo $poll;

are the double/body/headers coming from another template?

legionofangels 09-25-2008 03:52 PM

This is:

adv_portal_pollresult


HTML Code:

<tr>
        <td class="$bgclass">
                <span class="smallfont"><if condition="$show['voteital']"><em>$option[question] - $option[percent]%</em><else />$option[question] - $option[percent]%</if></span><br />
<img alt="" height="10" src="$stylevar[imgdir_poll]/bar$option[graphicnumber]-l.gif" width="3" /><img alt="$option[votes] <if condition="$option['votes'] <> 1">$vbphrase[votes]<else />$vbphrase[vote]</if>" height="10" src="$stylevar[imgdir_poll]/bar$option[graphicnumber].gif" width="$option[barnumber]" /><img alt="" height="10" src="$stylevar[imgdir_poll]/bar$option[graphicnumber]-r.gif" width="3" />
        </td>
</tr>

That is all the templates.

Lynne 09-25-2008 03:52 PM

I really don't know anything about iframes, so I don't know if that will fix the error. Did you look in the page source and see what I am talking about?

Tact7626 09-25-2008 03:57 PM

yep. we see it. were still trying to figure out what part of the mypoll.php is making it come out.

it's definately mypoll.php. but idk php so i don't know how he's making a whole new page echo out like that.

Lynne 09-25-2008 04:01 PM

Hmmm, I'm really not sure either. I guess I might go and compare mypoll.php to usage.php and see what the differences are.

legionofangels 09-25-2008 04:02 PM

Quote:

Originally Posted by Lynne (Post 1630111)

Also, you may want to correct this line (//feed2.js is incorrect):
HTML Code:

<script language="JavaScript" src="http://feed2js.org//feed2js.php?src=http%3A%2F%2Frss.cnn.com%2Frss%2Fcnn_showbiz.rss&amp;chan=title&amp;num=7&amp;desc=1" type="text/javascript"></script>

Those 3 feeds in the top 3 boxes will be replaced, it's jumbled at the moment the lower left box looks like unfinished code, but it's more like unfinished CSS, that works and will be applied to 5 off those 6 boxes in different arrays.

Quote:

Originally Posted by Lynne (Post 1630149)
I really don't know anything about iframes, so I don't know if that will fix the error. Did you look in the page source and see what I am talking about?

I know even less than he does on the php. The iframe didn't work we isolated it to that bottom middle box and the 6th lower right box which disappears when we make the error occur is now back but the iframe is showing no data or information what so ever, just a blank white box. So the iframe didn't work either.

--------------- Added [DATE]1222362390[/DATE] at [TIME]1222362390[/TIME] ---------------

Quote:

Originally Posted by Lynne (Post 1630155)
Hmmm, I'm really not sure either. I guess I might go and compare mypoll.php to usage.php and see what the differences are.

I think what you're basically saying is look for html in those php files? That shouldn't be there??

Lynne 09-25-2008 04:14 PM

Quote:

Originally Posted by legionofangels (Post 1630156)
I think what you're basically saying is look for html in those php files? That shouldn't be there??

Well, something in your mypoll.php file is spitting out the html, but the usage.php page is not. So, I would look to see the differences between the two files.

legionofangels 09-25-2008 04:14 PM

This is our usage php file:

PHP Code:

<?php 
/**
 * VB Recent Topics - example usage and instructions
 * @author George Gonzalez <webmaster@socaltrailriders.org>
 * @version 2.0
 * @package Recent_Topics
 * @link https://vborg.vbsupport.ru/showthread.php?t=134320
 */


// THIS MUST BE CALLED FIRST. IF DOING FROM A DIFFERENT DIRECTLY, ADJUST THE FOLLOWING...
require_once('./recenttopics/recent_topics.class.php');


/**
 * DISPLAY OPTIONS
 **/
 
/* 
    Include_from and exclude_from are forum ID filters. Use one or the other but 
    NOT both. List the forum ID's seperated by commas. Defaults to all forums if
    nothing is present.
    
    ex1) to include only forums with ID's 45, 47, and 50...
    'include_from' => '45,47,50'
    
    ex2) to exclude forums with ID's 11, 13, 18...
    'exclude_from' => '11,13,18'
    
    Quantity is how many topics to bring back. This is optional. Default is 10.
    
    Time format is the same date() format. Refer to http://us.php.net/date for details. 
    This is optional and defaults to 3:34 PM.
*/ 
$options = array(    'include_from'     => '34',
                    
'exclude_from'     => '',        
                    
'quantity'        => '10',
                    
'time_format'    => 'g:i A');
    
// initialize the recent_topics object and stick the options array into it                        
$rt = new recent_topics($options);

/* 
    From here, you have lots of options. If you're okay with PHP, use get_array()
    to retrieve the raw topic data and format the output however you want...
    
    ex3) $topics_array = $rt->get_array();
    
    Use get_html_table() to return a string of the recent topics in table format...
    
    ex4)     $topics_table = $rt->get_html_table();
            echo $topics_table;
            
    Use get_html_list() to return a string of the recent topics in list format...
    
    ex5)     $topics_list = $rt->get_html_list();
            echo $topics_list;
            
    Or, directly output a table or list with either the display_html_table() or 
    display_html_list() methods...
    
    ex6) $rt->display_html_table();
    ex7) $rt->display_html_list();            
*/

echo "<p><strong>Example of HTML table output with display_html_table()</strong></p>";
$rt->display_html_table();

echo 
"<p><strong>Example of HTML list output with display_html_list()</strong></p>";
$rt->display_html_list();

echo 
"<p><strong>Example of array from get_array()...</strong></p>";
echo 
'<pre>';
print_r($rt->get_array());
echo 
'</pre>';

// now, unset the object to close the db connection and clean it up
unset($rt);

// you may rinse and repeat however many times you want ...

?>


Lynne 09-25-2008 04:33 PM

Turn on this and see what comes out - vboptions > General Settings > Add Template Name in HTML Comments > set to Yes . Then go back to your page and view the source code and you will see the name of the template called around your part of the code.

Tact7626 09-25-2008 04:55 PM

awesome idea. i never knew that existed. i got this

<!-- BEGIN TEMPLATE: STANDARD_ERROR -->

and the closer as well. "end template: standard_error"

this is wierd cause... i was under the impression that the mypoll.php was adding html that was ruining everything and causing all the problems. but now it seems there is 1 problem first, which then creates the broken html problem.

so first, the code either doen'st work or something is going wrong, and then, as a result, the error template gets spewed which breaks the index html formatting.

that's my guess on all this. correct me if i'm wrong

legionofangels 09-25-2008 04:56 PM

The code worked last night when the guy installed it. I seen it, i voted on it, it worked, then a half hour later I refreshed the page and it was messed up.

Lynne 09-25-2008 05:04 PM

So, what changed between when you saw it and when it stopped working? Where other polls added to the site? *Something* changed.

OK, we know that since there is an error, the STANDARD_ERROR template is being called and that is putting in the whole new html page and causing the header error. (So, it's kinda an error causing another error.) We need to find what the original error is.

Have you looked in your apache error_logs?

I have written in some notes that you can put this line in a php page to help spit out errors:
PHP Code:

ini_set("display_errors"2); 

It would need to be set in <php> tags to be included. I've haven't had a need to use that yet, so I don't know exactly what it'll do. :eek:

Of course, I just went to test your page again and it is now displaying fine (the copy I made on my site is fine, I mean.). Trying to troubleshoot things like this is fun, fun, fun!

Tact7626 09-25-2008 05:23 PM

lol. i was thinking it better to find the error template, kill the header and closer, and then i should get the first error right? O_o or at least the page will look better while i still have the other error? :p

--------------- Added [DATE]1222368135[/DATE] at [TIME]1222368135[/TIME] ---------------

....wow!!!

guess wut? i deleted the html tags from the standard:error template in vb, got rid of the iframe i used to enclose mypoll.php, and it all suddenly works now. O_o

what happend to the error that was causing the error page??

legionofangels 09-25-2008 05:50 PM

Yet after it appearing, and appearing when I changed styles because apparently all those templates needed to be on all styles which they are now.

I cleared cookies/cache on both IE 7 and FF 3.x and now it shows the error again.

Ridiculous

Lynne 09-25-2008 05:55 PM

Yep, I am still seeing the error also when I view your page. All is still fine on the page I have on my test site. The only changes I made for the test site where to change the path for the css, usage.php, and mypoll.php files.

I don't know if it does anything regarding this error, but the whole DOCTYPE thing should be on one line.)

legionofangels 09-25-2008 05:59 PM

Correction - the templates weren't fixed on all styles, only on Default.

Our Default style is Crucifixion for the forum, so when he adds the template changes to all styles we believe the code will be fixed. But stay tuned.

Another thing I'm noticing is that when it does work its not showing a graphical display but a numerical one, how do I show a graphical display of the poll bars. It's in some of the coding but not appearing. My poll bars are all gifs to, so it's not a PNG thing.

Lynne 09-25-2008 06:02 PM

1 Attachment(s)
It is showing as a graphical display on my test site.

Tact7626 09-25-2008 06:08 PM

error template fixed on all templates. should work now. i guess

Lynne 09-25-2008 06:20 PM

I don't know what is up with that page right now (could be my ISP or something else), but this error is in the page source:

<b>Warning</b>: include(mypoll.php) [<a href='function.include'>function.include</a>]: failed to open stream: No such file or directory in <b>/homepages/26/d196297218/htdocs/index2.php</b> on line <b>101</b><br />
<br /><b>Warning</b>: include() [<a href='function.include'>function.include</a>]: Failed opening 'mypoll.php' for inclusion (include_path='.:/usr/lib/php5') in <b>/homepages/26/d196297218/htdocs/index2.php</b> on line <b>101</b><br />

legionofangels 09-25-2008 06:28 PM

He probably didn't remove the grab "mypoll.php" line from the index when you looked. Then we think our server got really busy for a second.

Another concept here that might be totally off is that maybe we have conflicting codes on the page.

As you are testing just the poll code, not the other code we have next to it, or that one showing recent posts. I think I'm wrong but I'm throwing it out there.

Lynne 09-25-2008 06:49 PM

Quote:

Originally Posted by legionofangels (Post 1630263)
He probably didn't remove the grab "mypoll.php" line from the index when you looked. Then we think our server got really busy for a second.

Another concept here that might be totally off is that maybe we have conflicting codes on the page.

As you are testing just the poll code, not the other code we have next to it, or that one showing recent posts. I think I'm wrong but I'm throwing it out there.

I've got the whole source that you posted in this thread on my test site.

Something you could try is changing your path in your include statement:
include('./mypoll.php');
or
include('/home/yoursite/mypoll.php');

legionofangels 09-25-2008 08:14 PM

Quote:

Originally Posted by Lynne (Post 1630283)
I've got the whole source that you posted in this thread on my test site.

Something you could try is changing your path in your include statement:
include('./mypoll.php');
or
include('/home/yoursite/mypoll.php');

Is that what you did?

Lynne 09-25-2008 08:19 PM

Quote:

Originally Posted by legionofangels (Post 1630378)
Is that what you did?

Well, no, cuz I can't. I had to do a direct link:
include('http://www.legionofangels.net/mypoll.php');

Dismounted 09-26-2008 05:37 AM

It's empty now... Attempts to access mypoll.php directly come back with a 404.

legionofangels 09-26-2008 12:47 PM

Quote:

Originally Posted by Dismounted (Post 1630628)
It's empty now... Attempts to access mypoll.php directly come back with a 404.

That's because we temporarily removed it to finish the other coding and CSS on the front page redesign (part 1). Part 2 is just related to the blog.

Anyways, this is the site that I found it on:

http://www.sportsrant.com/

Of which that is the dude I got it from the owner of that site. He actually has a flash poll modification here at vb.org but he said that isn't the one on his page when I added him to msn. I just wanted to ask, because I was like, that doesn't look like flash to me. It looks like vb normal code ( < you know what i mean ).

The issue with his code that I don't like is that when you vote it takes you to the thread, I'd rather it sit still and let you see the results on the front page. If you go back to the Home page and/or hit refresh you'll see the results on the front page knowing that you've voted, probably a cookie doing that. Any poll system on any site such as nfl.com which I frequent a lot of FOX Sports automatically shows you the results, kind of like flash but it could be done with Java I bet and others perhaps.

But there is no point of me getting into how I'd like it to work if I can't even get it to work.

As I said we stopped only temporarily on this, I haven't seen the coder I hire for $ in like 2 weeks online, so I can't ask him to just step in and fix this.

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

HOWEVER,

What I've determined or am wondering on your opinions is where the error actually is. See I obviously believe in my semi-experienced site coder however he is not an expert and maybe there is a coding error on the front page that is conflicting with the script. OR maybe the codes we have up for latest posts in certain forums conflict with the poll code.

All I know is an HTML error trying to access or open 2 pages on the same page doesn't make sense. ( it's true obviously but why would the poll code do that? )

I know that if it works on your guys test sites but doesn't work on my existing site tells me something is wrong and I can't find the conflict.

I'd like to run my stuff or my page with it on, in one of those HTML examiners to see if it can tell me what the heck is wrong.

In short what I'm trying to say is, I don't know what the error even is to fix it, and I don't understand why it's creating that HTML error. I contacted vBSEO as well because it says on the front page when the error occurs, Search Engine Friendly, etc. and I said your URL for vBSEO should not even be appearing on my front page. They are willing to go in the FTP and make sure that the vBSEO and vBSEO sitemap are working fine, but if they are, then it's not the SEO doing something.

Again, still looking for the light in the tunnel here.

P.S. I'm aware from another thread that vb.org will not release it's front page poll system and that is fine. Be advised though that I'd gather our codes are extremely similar if not exact...minus whatever error is occurring and I fully intend whether I have to pay for this code or not to release this here on .org so that all forum owners have the option of poll on front page. It gives users the opportunity to create there own CMPS basically with an add on such as poll, posts, or whatever, without having to just go get VB Advanced. So I'm eventually going to figure this out and release it.

Especially after all you're help and nearly 40 posts.

Tact7626 09-26-2008 04:59 PM

i think something with vb is prolly not playing well with his poll. did you ever check what version of vbulletin the guy who created the poll is running?

only now do i realize, if were getting vbseo messages in the error message. that's ONE clue that it's the forum mucking things up.

the second clue was how i had to go into vbulletin, and remove the header and footer from the error template to "kinda" get it to work.

so in the end. i think our front page is perfectly legit and free and clear of any possilbe "conflicts" it would make. and i would instead blame VBULLETIN as the one doing all this.

maybe vb and his poll just ain't the right version numbers? can't play along? idk. that's where i stand now.


All times are GMT. The time now is 06:16 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01777 seconds
  • Memory Usage 2,049KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (7)bbcode_html_printable
  • (4)bbcode_php_printable
  • (10)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete