Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Need help adding traffic stats to story.php please help :(
Old 11-26-2007, 10:52 AM Need help adding traffic stats to story.php please help :(
bbrian017's Avatar
Super Talker

Posts: 110
Trades: 0
I'm trying to add traffic stats to the story.php but I get an error when selecting the comments and trying to place a comment. I add the traffic stats code to the footer and I can't verify it's even there. Where would I add the following code?

<script type="text/JavaScript"
src="http://rt.trafficfacts.com/tf.php?k=11515g75e1c649e4c606399172afad0fa3bd67c22 fe6aeh6&c=s">
</script>


The error I get when adding this to the top of the page only when selecting comments and leaving comments is as follows,
PHP Code:
WarningCannot modify header information headers already sent by (output started at /home/content/b/b/r/bbrian017/html/blogengage/story.php:1in /home/content/b/b/r/bbrian017/html/blogengage/story.php on line 78

Warning
Cannot modify header information headers already sent by (output started at /home/content/b/b/r/bbrian017/html/blogengage/story.php:1in /home/content/b/b/r/bbrian017/html/blogengage/story.php on line 80 
This is the story.php file

PHP Code:
<?php

// The source code packaged with this file is Free Software, Copyright (C) 2005 by

// Ricardo Galli <gallir at uib dot es>.

// It's licensed under the AFFERO GENERAL PUBLIC LICENSE unless stated otherwise.

// You can get copies of the licenses here:

//         http://www.affero.org/oagpl.html

// AFFERO GENERAL PUBLIC LICENSE is also included in the file called "COPYING".



include_once('Smarty.class.php');

$main_smarty = new Smarty;



include(
'config.php');

include(
mnminclude.'html1.php');

include(
mnminclude.'link.php');

include(
mnminclude.'smartyvariables.php');

include(
mnminclude.'pageview.php');



if(isset(
$_REQUEST['id'])){$requestID strip_tags($_REQUEST['id']);}

if(isset(
$_REQUEST['title'])){$requestTitle strip_tags($_REQUEST['title']);}

// if we're using "Friendly URL's for categories"

if(isset($_REQUEST['category'])){$thecat $db->get_var("SELECT category_name FROM " table_categories " WHERE `category_safe_name` = '".urlencode(sanitize($_REQUEST['category'], 1))."';");}



if(isset(
$requestID) && enable_friendly_urls == true){

    
// if we're using friendly urls, don't call /story.php?id=XX  or /story/XX/

    // this is to prevent google from thinking it's spam

    // more work needs to be done on this



    
$link = new Link;

    
$link->id=$requestID;

    if(
$link->read() == false){

        
$main_smarty->assign('tpl_center'$the_template '/404error');

        
$main_smarty->display($the_template '/pligg.tpl');        

        die();

    }



    
$url getmyurl("storyURL"$link->category_safe_name($link->category), urlencode($link->title_url), $link->id);



    
Header"HTTP/1.1 301 Moved Permanently" );

    
Header"Location: " $url );

    

    die();

}



// if we're using "Friendly URL's for stories"

if(isset($requestTitle)){$requestID $db->get_var("SELECT link_id FROM " table_links " WHERE `link_title_url` = '$requestTitle';");}



if(
is_numeric($requestID)) {

    
$id $requestID;

    
$link = new Link;

    
$link->id=$requestID;

    if(!
$link->read()){

        
$main_smarty->assign('tpl_center'$the_template '/404error');

        
$main_smarty->display($the_template '/pligg.tpl');        

        die();

    }

    if(isset(
$_POST['process'])){

        if (
$_POST['process']=='newcomment') {

            
insert_comment();

        }

    }



    
// log the pageview

    
$pageview = new Pageview;

    
$pageview->type='story';

    
$pageview->page_id=$link->id;

    
$pageview->user_id=$current_user->user_id;

    require_once(
mnminclude.'check_behind_proxy.php');

    
$pageview->user_ip=check_ip_behind_proxy();

    

    
// find the last pageview

    
$last_visit $pageview->last_visit();

    if(
$last_visit != 0){$last_visit txt_time_diff($pageview->last_visit(), time());}

    
$main_smarty->assign('last_visit'$last_visit);

    
$pageview->insert();

    

    
// Set globals

    
$globals['link_id']=$link->id;

    
$globals['category_id']=$link->category;

    
$globals['category_name']=$link->category_name();

    
$globals['category_url']=$link->category_safe_name();

    
check_actions('story_top');



    
$main_smarty->assign('link_submitter'$link->username());



    
// setup breadcrumbs and page title

    
$main_smarty->assign('posttitle'" - " $link->title);

    
$navwhere['text1'] = $globals['category_name'];

    
$navwhere['link1'] = getmyurl('maincategory'makeCategoryFriendly($globals['category_url']));

    
$navwhere['text2'] = $link->title;

    
$navwhere['link2'] = getmyurl('storycattitle'makeCategoryFriendly($globals['category_url']), urlencode($link->title_url));

    
$main_smarty->assign('navbar_where'$navwhere);



    
// for the comment form

    
$randkey rand(1000000,100000000);

    
$main_smarty->assign('randkey'$randkey);

    
$main_smarty->assign('link_id'$link->id);

    
$main_smarty->assign('user_id'$current_user->user_id);

    
$main_smarty->assign('randmd5'md5($current_user->user_id.$randkey));



    
// for login to comment

    
$main_smarty->assign('register_url'getmyurl("register"''));

    
$main_smarty->assign('login_url'getmyurl("login"$_SERVER['REQUEST_URI']));



    
// for show who voted

    
$main_smarty->assign('user_url'getmyurl('userblank'""));

    
$main_smarty->assign('voter'who_voted($id'small'));



    
// misc smarty

    
$main_smarty->assign('Enable_Comment_Voting'Enable_Comment_Voting);

    
$main_smarty->assign('enable_show_last_visit'enable_show_last_visit);

    
$main_smarty->assign('Spell_Checker',Spell_Checker);

    
$main_smarty->assign('UseAvatars'do_we_use_avatars());

    
$main_smarty->assign('related_title_url'getmyurl('storytitle'""));

    
$main_smarty->assign('related_story'related_stories($id$link->tags$link->category));



    
// meta tags

    
$main_smarty->assign('meta_description'strip_tags($link->truncate_content()));

    
$main_smarty->assign('meta_keywords'$link->tags);

    

    
//sidebar

    
$main_smarty do_sidebar($main_smarty);    



    
// pagename

    
define('pagename''story'); 

    
$main_smarty->assign('pagename'pagename);



    
$main_smarty->assign('tpl_center'$the_template '/story_center');

    
$main_smarty->display($the_template '/pligg.tpl');

} else {

    
$main_smarty->assign('tpl_center'$the_template '/404error');

    
$main_smarty->display($the_template '/pligg.tpl');        

    die();

}



function 
get_comments (){

    Global 
$db$main_smarty$current_user$CommentOrder$link;

    

    
//Set comment order to 1 if it's not set in the admin panel

    
if(!isset($CommentOrder)){$CommentOrder 1;}

    If (
$CommentOrder == 1){$CommentOrderBy "comment_votes DESC, comment_date DESC";}

    If (
$CommentOrder == 2){$CommentOrderBy "comment_date DESC";}

    If (
$CommentOrder == 3){$CommentOrderBy "comment_votes DESC, comment_date ASC";}

    If (
$CommentOrder == 4){$CommentOrderBy "comment_date ASC";}

    

    
// get all parent comments

  
$comments $db->get_col("SELECT comment_id FROM " table_comments " WHERE comment_link_id=$link->id and comment_parent = 0 ORDER BY " $CommentOrderBy);

  if (
$comments) {

    require_once(
mnminclude.'comment.php');

    
$comment = new Comment;

    foreach(
$comments as $comment_id) {

      
$comment->id=$comment_id;

      
$comment->read();

      
$comment->print_summary($link);            

    

            
// get all child comments

            
$comments2 $db->get_col("SELECT comment_id FROM " table_comments " WHERE comment_parent=$comment_id ORDER BY " $CommentOrderBy);

            if (
$comments2) {

                echo 
'<div style="margin-left:40px">';

                require_once(
mnminclude.'comment.php');

                
$comment2 = new Comment;

                foreach(
$comments2 as $comment_id) {

                    
$comment2->id=$comment_id;

                    
$comment2->read();

                    
$comment2->print_summary($link);

                }

                echo 
"</div>\n";

            }

    

         }

  }

}





function 
insert_comment () {

    global 
$link$db$current_user;



    require_once(
mnminclude.'comment.php');

    
$comment = new Comment;



    
$cancontinue false;

    if(
$_POST['link_id'] == $link->id && $current_user->authenticated && $_POST['user_id'] == $current_user->user_id &&    $_POST['randkey'] > 0) {

        if(
strlen($_POST['comment_content']) > 0){

            
$comment->content=$_POST['comment_content'];

            
$cancontinue true;

            
// this is a normal new comment

        
}



        if(
strlen($_POST['reply_comment_content-'.$_POST['comment_parent_id']]) > 0){

            
$comment->content $_POST['reply_comment_content-'.$_POST['comment_parent_id']];

            
$comment->parent=$_POST['comment_parent_id'];

            
$cancontinue true;

            
// this is a reply to an existing comment

        
}



        if(
$cancontinue == true){

            
$comment->link=$link->id;

            
$comment->randkey=$_POST['randkey'];

            
$comment->author=$_POST['user_id'];

            
$comment->store();

            
header('Location: '.$_SERVER['REQUEST_URI']);

            die;

        }

    }

}

?>
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE

bbrian017 is offline
Reply With Quote
View Public Profile Visit bbrian017's homepage!
 
 
Register now for full access!
Old 11-26-2007, 11:09 AM Re: Need help adding traffic stats to story.php please help :(
Super Talker

Posts: 134
Trades: 0
you can put htlm code before the header function

ps the there is a > too much at the end of the source of the javascript
__________________

Please login or register to view this content. Registration is FREE

Check out the Facebook Clone build with Jcow SNS at
Please login or register to view this content. Registration is FREE
, it is free and it always will be
Falcone is offline
Reply With Quote
View Public Profile
 
Old 11-26-2007, 11:11 AM Re: Need help adding traffic stats to story.php please help :(
bbrian017's Avatar
Super Talker

Posts: 110
Trades: 0
ok well I hope we can do this together because I'm getting errors no matter where I add it

Where is the header function can you state the code for me?


Please

EDIT: Do you mean before or on line 78
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE


Last edited by bbrian017; 11-26-2007 at 11:12 AM..
bbrian017 is offline
Reply With Quote
View Public Profile Visit bbrian017's homepage!
 
Old 11-26-2007, 11:21 AM Re: Need help adding traffic stats to story.php please help :(
Super Talker

Posts: 134
Trades: 0
Header ("Location: ".$url) for example, there is more than 1 line like this in your script
__________________

Please login or register to view this content. Registration is FREE

Check out the Facebook Clone build with Jcow SNS at
Please login or register to view this content. Registration is FREE
, it is free and it always will be
Falcone is offline
Reply With Quote
View Public Profile
 
Old 11-26-2007, 11:23 AM Re: Need help adding traffic stats to story.php please help :(
bbrian017's Avatar
Super Talker

Posts: 110
Trades: 0
Well your posts aren't helping me and I don't mean to be rude when I say that but it's the truth. Could you be more specific and go as far to say Find: add after or before ?
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE

bbrian017 is offline
Reply With Quote
View Public Profile Visit bbrian017's homepage!
 
Old 11-26-2007, 11:48 AM Re: Need help adding traffic stats to story.php please help :(
Super Talker

Posts: 134
Trades: 0
i think before or after this block :

PHP Code:
    $main_smarty->assign('tpl_center'$the_template '/story_center');
    
$main_smarty->display($the_template '/pligg.tpl'); 
you can also put the code in your template (tpl )files

and here at the end of the second line you have to remove the > sign
HTML Code:
<script type="text/JavaScript"
src="http://rt.trafficfacts.com/tf.php?k=11515g75e1c649e4c606399172afad0fa3bd67c22  fe6aeh6&c=s">
</script>
__________________

Please login or register to view this content. Registration is FREE

Check out the Facebook Clone build with Jcow SNS at
Please login or register to view this content. Registration is FREE
, it is free and it always will be
Falcone is offline
Reply With Quote
View Public Profile
 
Old 11-26-2007, 11:51 AM Re: Need help adding traffic stats to story.php please help :(
bbrian017's Avatar
Super Talker

Posts: 110
Trades: 0
Parse error: parse error, unexpected '<' in /home/content/b/b/r/bbrian017/html/blogengage/story.php on line 251

This is the tpl file here,

PHP Code:
 {config_load file="/libs/lang.conf"}
<script type="text/javascript"><!--
google_ad_client = "pub-4639496444672477";
//728x90, blogengage header
google_ad_slot = "2640693711";
google_ad_width = 728;
google_ad_height = 90;
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script><br/><br/>
{if $enable_show_last_visit neq 0}
        {if $user_id neq 0}
                {if $last_visit neq '0'}
                        {#PLIGG_Visual_Story_LastViewed_A#}{$last_visit}{#PLIGG_Visual_Story_LastViewed_B#}<br />
                {else}
                        {#PLIGG_Visual_Story_FirstView#}<br />
                {/if}
        {/if}
{/if}

{php}
        Global $db, $main_smarty, $link;
        $link->print_summary();
{/php}

<br/>
<div id="story_tabs" class="cab">
        <span class="selected"><a href="#" rel="comments">{#PLIGG_Visual_Story_Comments#}</a></span>
        <span><a href="#" rel="who_voted">{#PLIGG_Visual_Story_Who_Voted#}</a></span>
        <span><a href="#" rel="related">{#PLIGG_Visual_Story_RelatedStory#}</a></span>
</div>
<div id="navbar" style="margin-left:0px;margin-right:0px"></div>
<script type="text/javascript"><!--
google_ad_client = "pub-4639496444672477";
//468x60, blogengage under topics
google_ad_slot = "0064543912";
google_ad_width = 468;
google_ad_height = 60;
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<div id="comments" style="display:none">
        <h2>{#PLIGG_Visual_Story_Comments#}</h2>

        {php}
                Global $db, $main_smarty, $current_user, $CommentOrder;
                get_comments();        // the get_comments function is in the /story.php file
        {/php}

        {if $user_authenticated neq ""}
                {include file=$the_template."/comment_form.tpl"}
        {else}
                <br/>
                <div align="center" style="clear:both;margin-left:auto;font-weight:bold;margin-right:auto;border-color:#ccc; border-style:solid; border-width:1px;width:400px;text-align:center; padding-bottom: 8px;">
                        <a href="{$login_url}">{#PLIGG_Visual_Story_LoginToComment#}</a> {#PLIGG_Visual_Story_Register#} <a href="{$register_url}">{#PLIGG_Visual_Story_RegisterHere#}</a>.
                </div>
        {/if}
</div>
<div align="center">
  <!-- Begin: AdBrite -->
  <script type="text/javascript">
   var AdBrite_Title_Color = '0000FF';
   var AdBrite_Text_Color = '0000FF';
   var AdBrite_Background_Color = 'FFFFFF';
   var AdBrite_Border_Color = 'FFFFFF';
</script>
  <span style="white-space:nowrap;">
  <script src="http://ads.adbrite.com/mb/text_group.php?sid=493751&zs=3732385f3930" type="text/javascript"></script>
  <!--
-->
  <a target="_top" href="http://www.adbrite.com/mb/commerce/purchase_form.php?opid=493751&afsid=1"><img src="http://files.adbrite.com/mb/images/adbrite-your-ad-here-leaderboard.gif" style="background-color:#FFFFFF" alt="Your Ad Here" width="14" height="90" border="0" /></a></span>
  <!-- End: AdBrite -->
</div>
<div id="who_voted" style="display:none">
        <h2>{#PLIGG_Visual_Story_WhoVoted#}</h2>
        <div class="whovotedwrapper" id="idwhovotedwrapper">
                <ol>
                        {section name=nr loop=$voter}
                                <li>
                                        {if $UseAvatars neq "0"}<img src="{$voter[nr].Avatar_ImgSrc}" alt="Avatar" align="absmiddle"/>{/if}
                                        <a href = "{$URL_user, $voter[nr].user_login}">{$voter[nr].user_login}</a><br/>
                                </li>
                        {/section}
                </ol>
        </div>
</div>

<div id="related" style="display:none">
        <h2>{#PLIGG_Visual_Story_RelatedStory#}</h2>
        <ol>
        {section name=nr loop=$related_story}
                <li><a href = "{$related_title_url}{$related_story[nr].link_title_url}">{$related_story[nr].link_title}</a><br/></li>
        {/section}
        </ol>

</div>

{literal}
<script type="text/javascript">
initializetabcontent("story_tabs")
</script>
{/literal}


{php}
?>
<style type="text/css">
  /* allow room for 3 columns */
  div#idwhovotedwrapper ol {width: 35em; list-style-type: none; }
  div#idwhovotedwrapper ol li {float: left; width: 10em; }
  div#idwhovotedwrapper br { clear: left; }
  div#idwhovotedwrapper div.whovotedwrapper { margin-bottom: 1em; }
</style>
<?php
{/php}

Also when I add it t the template file the goddady verify script can't find it!

__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE


Last edited by bbrian017; 11-26-2007 at 11:58 AM..
bbrian017 is offline
Reply With Quote
View Public Profile Visit bbrian017's homepage!
 
Old 11-26-2007, 01:37 PM Re: Need help adding traffic stats to story.php please help :(
Super Talker

Posts: 134
Trades: 0
at the bottom there is something wrong, between the last {php} and {/php} you have html code instead of php code
__________________

Please login or register to view this content. Registration is FREE

Check out the Facebook Clone build with Jcow SNS at
Please login or register to view this content. Registration is FREE
, it is free and it always will be
Falcone is offline
Reply With Quote
View Public Profile
 
Old 11-26-2007, 02:05 PM Re: Need help adding traffic stats to story.php please help :(
bbrian017's Avatar
Super Talker

Posts: 110
Trades: 0
I still don't know where to add the traffic stats script
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE

bbrian017 is offline
Reply With Quote
View Public Profile Visit bbrian017's homepage!
 
Old 11-26-2007, 02:29 PM Re: Need help adding traffic stats to story.php please help :(
Super Talker

Posts: 134
Trades: 0
did you try it after the "{config_load file="/libs/lang.conf"}" line in the template file
__________________

Please login or register to view this content. Registration is FREE

Check out the Facebook Clone build with Jcow SNS at
Please login or register to view this content. Registration is FREE
, it is free and it always will be
Falcone is offline
Reply With Quote
View Public Profile
 
Old 11-28-2007, 09:15 PM Re: Need help adding traffic stats to story.php please help :(
bbrian017's Avatar
Super Talker

Posts: 110
Trades: 0
hey thanks for all the help I found the html file that holds it all together and it's all solved. pligg.html or something. I forget now
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE

bbrian017 is offline
Reply With Quote
View Public Profile Visit bbrian017's homepage!
 
Reply     « Reply to Need help adding traffic stats to story.php please help :(
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 1.07852 seconds with 12 queries