How do I hook tradepulse up to the tube script?
Posted by Konrad Piwowar, Last modified by Konrad Piwowar on 01 November 2018 02:06 PM

The tradepulse documentation states that you must put the following code in your <head> tag:

<?php virtual("/tp/ssi_in.php")?>


This, however, will cause a php error in the case of the tube script. The tradepulse code will often throw a php error about gzip compression and give you a blank white page on pages such as login, signup etc.

There are two workarounds available.

1) You can disable mod_gzip in apache and any compress/gzip/etc stuff in php.ini, restart apache and the above code will work.
2) You can use the following code in your <head> tag in template.overall_header.php instead:

if($thisfile == 'index') {

In addition to adding this code, you must also make your video page links run through tradepulse. This is accomplished by doing the following (example using default template):

BOF template.content_item.php:

$bad = array('?','!',' ','&','*','$','#','@');
$good = array('','','-','','','','','');
$link = "$basehttp/videos/".strtolower(str_replace($bad,$good,$row[title]))."-".$row[record_num].".html";
$dirname = str_replace('.flv','',$row[orig_filename]);
$subdir = $row[filename][0].'/'.$row[filename][1].'/'.$row[filename][2].'/'.$row[filename][3].'/'.$row[filename][4].'/';
$dirname = $subdir.$dirname;
$uniq = uniqid();

                <div class="content">
                         <? if($row[embed]) { ?>
        <a href="/tp/out.php?p=60&url=<? echo $link; ?>" target="_self"><img  class="img" src="<? echo $thumb_url; ?>/embedded/<? echo $row[record_num]; ?>.jpg" alt="<? echo $row[title]; ?>" height="<? echo $thumbheight; ?>" width="<? echo $thumbwidth; ?>" border=0 /></a>
    <? } else { ?>
        <script type='text/javascript'>stat['<? echo $uniq; ?>']=0; pic['<? echo $uniq; ?>']=new Array(); pics['<? echo $uniq; ?>']=new Array(1,1,1,1,1,1,1,1,1,1);</script>
        <a href="/tp/out.php?p=60&url=<? echo $link; ?>" target="_self"><img src="<? echo $thumb_url; ?>/<? echo $dirname; ?>/<? echo $row[orig_filename]; ?>-<? echo $row[main_thumb]; ?>.jpg" alt="<? echo htmlentities($row[title]); ?>" name="<? echo $uniq; ?>" id='<? echo $uniq; ?>' onmouseover='startm("<? echo $uniq; ?>","<? echo $thumb_url; ?>/<? echo $dirname; ?>/<? echo $row[orig_filename]; ?>-",".jpg");' onmouseout='endm("<? echo $uniq; ?>"); this.src="<? echo $thumb_url; ?>/<? echo $dirname; ?>/<? echo $row[orig_filename]; ?>-<? echo $row[main_thumb]; ?>.jpg";' class="img" height="<? echo $thumbheight; ?>" width="<? echo $thumbwidth; ?>" border=0 /></a>
        <? } ?>

                        <div class="vtitle">
                        <a href="<? echo $link; ?>"><?  echo truncate($row[title],15);   ?></a>
                        <!-- class="vtitle" --></div>

                        <div class="rating"><div class="star_off"><div class="star_on" style="width:<? echo ceil($row[rating]*10); ?>px"></div></div></div>
                        <div class="time"><b><? echo sec2time($row[length]); ?></b></div>
                        <div class="date"><b><? echo datediff('',$row[encoded_date],date('Y-m-d H:i:s'),false); ?></b> ago</div>
                        <div class="views"><b><? echo $row[views]; ?></b> views</div>

                        <div class="clear"></div>
                <!-- class="content" --></div>



As you can see from the above example, we've add the following code before <? echo $link; ?> in the html: /tp/out.php?p=60&url=

Please notice that we have only installed the code on the thumbnail's <a> tag, and not the text link. You can of course run the text link through tradepulse as well, but for SEO reasons we recommend leaving the text link as a direct link without tradepulse (the vast majority of users click the thumbnail)

(5 vote(s))
Not helpful

Comments (0)
Post a new comment
Full Name:
CAPTCHA Verification 
Please enter the text you see in the image into the textbox below (we use this to prevent automated submissions).