Coder Social home page Coder Social logo

yandex-turbo-pages-php5's Introduction

PHP5 Yandex Turbo Pages RSS feed generator

Latest Stable Version Total Downloads Latest Unstable Version composer.lock PHPPackages Rank PHPPackages Referenced By
Travis CI Build Status
Scrutinizer CI Build Status Scrutinizer Code Quality Code Coverage

Russian version of README you can find here: README_RU.md.

Yandex Turbo Pages valid RSS feed generator for PHP5.4+.

Version for PHP7 or later you can find here.

Examples

This example you can find in examples/example.php

// creates Feed with all needed namespaces
$feed = new Feed();

// creates Channel with description and one ad from Yandex Ad Network
$channel = new Channel();
$channel
    ->title('Channel Title')
    ->link('http://blog.example.com')
    ->description('Channel Description')
    ->language('ru')
    ->adNetwork(Channel::AD_TYPE_YANDEX, 'RA-123456-7', 'first_ad_place')
    ->appendTo($feed);

// adds Google Analytics to feed
$googleCounter = new Counter(Counter::TYPE_GOOGLE_ANALYTICS, 'XX-1234567-89');
$googleCounter->appendTo($channel);

// adds Yandex Metrika to feed
$yandexCounter = new Counter(Counter::TYPE_YANDEX, 12345678);
$yandexCounter->appendTo($channel);

// creates first page of feed with link and enabled turbo, description and other content, and appends this page to channel
$item = new Item();
$item
    ->title('Thirst page!')
    ->link('http://www.example.com/page1.html')
    ->author('John Smith')
    ->category('Technology')
    ->turboContent('Some content here!<br>Second content string.')
    ->pubDate(strtotime('Tue, 21 Aug 2012 19:50:37 +0900'))
    ->appendTo($channel);

// creates list of related pages
$relatedItemsList = new RelatedItemsList();

// adds link to first related page
$relatedItem = new RelatedItem('Related article 1', 'http://www.example.com/related1.html');
$relatedItem->appendTo($relatedItemsList);

// adds link to second related page with image
$relatedItem = new RelatedItem('Related article 2', 'http://www.example.com/related2.html',
    'http://www.example.com/related2.jpg');
$relatedItem->appendTo($relatedItemsList);

// appends list of related links to first page
$relatedItemsList
    ->appendTo($item);

// creates another one page with disabled turbo
$item = new Item(false);
$item
    ->title('Second page!')
    ->link('http://www.example.com/page2.html')
    ->author('John Smith')
    ->category('Technology')
    ->turboContent('Yet another content here!')
    ->pubDate(strtotime('Tue, 21 Aug 2012 19:50:37 +0900'))
    ->appendTo($channel);

// displays the generated feed
echo $feed;

For generating content for turbo items you can use Content helper. For example:

// generate header
$menuArray = [
    ['url' => 'http://example/page1.html', 'title' => 'Page title 1'],
    ['url' => 'http://example/page2.html', 'title' => 'Page title 2']
];
$header = Content::header('Main title', 'Second title',
    'http://example.com/image1.jpg', 'Image description', $menuArray);

At this time you can use helpers for generate next elements:

  • page header including menu;
  • image;
  • images gallery;
  • share buttons;
  • link or phone button;
  • comments;
  • rating;
  • accordion;
  • video from own server;
  • video from external server;
  • ad block position element;
  • media-content with slider;
  • additional content block;
  • search input.

Examples of using helpers you can find in examples/content_helpers.php.

Installing

# Install Composer
curl -sS https://getcomposer.org/installer | php

Next, run the Composer command to install the latest stable version of yandex-turbo-pages

php composer.phar require sokolnikov911/yandex-turbo-pages-php5

After installing, you need to require Composer's autoloader:

require 'vendor/autoload.php';

You can then later update yandex-turbo-pages using composer:

composer.phar update

Requirements

This Yandex Trurbo Pages RSS feed generator requires at least PHP5.4.

License

License

This library is licensed under the MIT License.

yandex-turbo-pages-php5's People

Contributors

g1k avatar sokolnikov911 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

g1k

yandex-turbo-pages-php5's Issues

Item header

Может быть добавить пару методов чтобы добавлять заголовок страницы и главное изображение?

<header>
<figure>
<img src="" />
</figure>
<h1></h1>
</header>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.