1. Go to this page and download the library: Download roadiz/abstract-blog-theme 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/ */
roadiz / abstract-blog-theme example snippets
use Themes\AbstractBlogTheme\AbstractBlogThemeApp;
class MyThemeApp extends AbstractBlogThemeApp
{
//…
}
use Themes\AbstractBlogTheme\Services\BlogServiceProvider;
/**
* {@inheritdoc}
*/
public function register(\Pimple\Container $container)
{
parent::register($container);
$container->register(new BlogServiceProvider());
}
/**
* @param Container $container
*/
public static function setupDependencyInjection(Container $container)
{
parent::setupDependencyInjection($container);
$container->extend('blog_theme.post_container_entity', function ($entityClass) {
return NSBlogPostContainer::class;
});
$container->extend('blog_theme.post_entity', function ($entityClass) {
return NSBlogPost::class;
});
}
namespace Themes\MyTheme\Controllers;
use Themes\AbstractBlogTheme\Controllers\ConfigurableController;
use Themes\AbstractBlogTheme\Controllers\PostContainerControllerTrait;
use Themes\MyTheme\MyThemeThemeApp;
class BlogPostContainerController extends MyThemeThemeApp implements ConfigurableController
{
use PostContainerControllerTrait;
}
namespace Themes\MyTheme\Controllers;
use Themes\AbstractBlogTheme\Controllers\ConfigurableController;
use Themes\AbstractBlogTheme\Controllers\PostContainerControllerTrait;
use Themes\MyTheme\MyThemeThemeApp;
abstract class AbstractContainerController extends MyThemeThemeApp implements ConfigurableController
{
use PostContainerControllerTrait;
// common methods overriding here…
}
namespace Themes\MyTheme\Controllers;
class BlogPostContainerController extends AbstractContainerController
{
// override whatever you want
}
class PressReviewContainerController extends AbstractContainerController
{
// override whatever you want
}
[
$this->getPublicationField() => 'DESC'
]
namespace Themes\MyTheme\Controllers;
use Themes\AbstractBlogTheme\Controllers\ConfigurableController;
use Themes\AbstractBlogTheme\Controllers\PostControllerTrait;
use Themes\MyTheme\MyThemeThemeApp;
class BlogPostController extends MyThemeThemeApp implements ConfigurableController
{
use PostControllerTrait;
}
namespace Themes\MyTheme\Controllers;
use Themes\AbstractBlogTheme\Controllers\ConfigurableController;
use Themes\AbstractBlogTheme\Controllers\SearchControllerTrait;
use Themes\MyTheme\MyThemeApp;
class SearchController extends MyThemeApp implements ConfigurableController
{
use SearchControllerTrait;
}