Tinypass动态数据

时间:2013-06-13 14:33:50

标签: php

我使用Tinypass.com作为付费专区,并希望在代码中显示数据库表中的数据。

我想替换下面的地方:'回收数据表格DB去这里'

到目前为止,我有:

    <?php 
        /* Include TinyPass - make sure to use the correct path */
        include_once "lib/TinyPass.php";

        // configure Tinypass
        TinyPass::$SANDBOX = true;

        # Chanage these values with your TinyPass applicatin's settings
    TinyPass::$AID          = "76JigADEH5";
        TinyPass::$PRIVATE_KEY  = "aj43agFz9ZGxq8yPlZN4PHn01Xiy0bnezWmpEirC";

        /*
        If you want to integrate this system with logged in user then RID should be [ObjectName-UserID]
        */
        $rid = "Content-1"; #unique_resource_id
        $store = new TPAccessTokenStore();
        $store->loadTokensFromCookie($_COOKIE);
        $token = $store->getAccessToken($rid);

        # If anonymous user has rights to see content
        if($token->isAccessGranted()) {
            //Access granted! Display requested resource to the user
            echo '<div class="vendor"><iframe src="http://player.vimeo.com/video/25708134?title=0&amp;byline=0&amp;portrait=0" width="500" height="281" frameborder="0"></iframe></div>';   } else {
            echo '<div style="background-color:#D3768D; width:100%; height:281px;"></div><div style="padding:15px;" >

            ECHO DATA FORM DB TO GO HERE 

            <br> ';
            $resource = new TPResource("$rid", "Paid Content");

            //Create 3 price options
            $po1 = new TPPriceOption("5.00", "24 hours");
            $po2 = new TPPriceOption("10.00", "72 hours");
            $po3 = new TPPriceOption("20.00", "30 days");

            $offer = new TPOffer($resource, $po1);
            $offer->addPriceOption($po2);
            $offer->addPriceOption($po3);
    $ticketoptions = array();
$ticketoptions["btn.size"] = "2";
$purchaseRequest = new TPPurchaseRequest($offer, $ticketoptions);

            $buttonHTML = $purchaseRequest->generateTag();

            //output button HTML in the place where Tinypass button is supposed to be rendered
             echo  $buttonHTML;
        }   

    ?>

通常我会使用:

<?php echo $row_tutorial['text_after']; ?>

但显然这不适用于另一个标签。任何想法

1 个答案:

答案 0 :(得分:0)

所以你想要的是concatenated string

echo '<div style="background-color:#D3768D; width:100%; height:281px;"></div><div style="padding:15px;" >' .  $row_tutorial['text_after']. '<br> ';