PHP code example of sqweb / symfony_bundle

1. Go to this page and download the library: Download sqweb/symfony_bundle library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

sqweb / symfony_bundle example snippets


    new SQweb\SQwebBundle\SQwebSQwebBundle()
    

{{ sqweb.script|raw }}

{% if sqweb.abo %}
    //CONTENT
{% else %}
    //ADS
{% endif %}

{{ sqweb.button|raw }}

{{ sqweb.buttonTiny|raw }}
OR
{{ sqweb.buttonSlim|raw }}
OR
{{ sqweb.buttonLarge|raw }}

/**
 * Display a support block.
 */

function supportBlock() {   }
``

For instance:


/**
 * Display a locking block.
 */

function lockingBlock() {   }
``

For instance:


{% if sqweb.waitToDisplay('2016-09-15', 2) %}
    // The content here will appear the 2016-09-17, 2 days after the publication date for non paying users.
{% else %}
    // Here you can display a message that free users will see while your article is not displayed
    {{sqweb.lockingBlock|raw}}
{% endif %}

/**
 * Put opacity to your text
 * Returns the text with opcaity style.
 * @param text, which is your text.
 * @param int percent which is the percent of your text you want to show.
 * @return string
 */

public function transparent($text, $percent = 100) { ... }

{{ sqweb.transpartext('one two three four', 50)|raw }}

/**
 * Display your premium content at a later date to non-paying users.
 * @param  string  $date  When to publish the content on your site. It must be an ISO format(YYYY-MM-DD).
 * @param  integer $wait  Days to wait before showing this content to free users.
 * @return bool
 */

public function waitToDisplay($date, $wait = 0) { ... }

{% if sqweb.waitToDisplay('2016-09-15', 2) %}
    // The content here will appear the 2016-09-17, 2 days after the publication date for non paying users.
{% else %}
    // Here you can display a message that free users will see while your article is not displayed
{% endif %}

/*
 * @param int $limitation  Number of articles a free user can see.
 */

function limitArticle($limitation = 0) { ... }

{% if sqweb.limitArticle(5) %}
    // Put your content here
{% else %}
    // Here you can display a message that free users will see while your article is not displayed
{% endif %}