Giter VIP home page Giter VIP logo

bw_cache_uri's Introduction

DOM Downloader

This TYPO3 extension extends the tt_content element HTML for the functionality of loading and postprocessing remote content.

Example Image

Features

  • Load and save remote content from URL
  • Filter saved DOM with CSS selectors
  • Manipulate the content with custom post-processors (e.g. stripe tags, add wrap,..)
  • Options for processors via TypoScript
  • Scheduler task to refresh content

Install

  1. Install via composer
composer require blueways/bw-cache-uri
  1. Include TypoScript template

Usage

Just create a new HTML-Content Element and add any URL in the parsing options. After saving, the remote content is fetched, processed and saved.

Scheduler

The DOM Downloader task will refresh the bodytext of all tt_content elements that have a parsing uri set.

Post Processor

After receiving the remote content, custom post processors can be applied to transform the content, e.g. to wrap or remove text. To register a new processor, add the following TypoScript:

plugin.tx_bwcacheuri.settings.postProcessors {
    Vendor\YourExt\Processor\MyFancyProcessor {
        label = Name in select box
        options {
            custom_setting = 2,4
            allowed_tags = <div>
        }
    }
}

Your processor class must implement the PostProcessorInterface:

<?php
namespace Vendor\YourExt\Processor;

class MyFancyProcessor implements \Blueways\BwCacheUri\Processor\PostProcessorInterface
{
    public function process($dom, $options)
    {
        return strip_tags($dom, $options['allowed_tags']);
    }
}

DDEV cron job

See ddev-contrib to see how to make the scheduler run locally.

Examples

Use Filter to get current weather

Weather example

Get current Time

Time example

bw_cache_uri's People

Contributors

maikschneider avatar

Watchers

 avatar

bw_cache_uri's Issues

Problem with typo3 11.5 and news Extension after installing bw_cache_uri

When a News element is present on the page and displays the List View, I encounter the following error:

'The default controller for extension "News" and plugin "Pi1" cannot be determined. Please check for TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin() in your ext_localconf.php.

The Problem is that, how the dom_processor options is added to the tt_content tca. The provided code should be placed in the tt_content.php instead ext_tables.php, after the definition of the 'parsing_options' palette.

// A4. Show palette
$GLOBALS['TCA']['tt_content']['palettes']['parsing_options'] = [
    'showitem' => 'dom_uri,--linebreak--,dom_filter,--linebreak--,dom_processor'
];

// B - Read TypoScript and add DOM processors
$objectManager = GeneralUtility::makeInstance(ObjectManager::class);
$configurationManager = $objectManager->get(ConfigurationManager::class);
$typoscript = $configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT);

if (isset($typoscript['plugin.']['tx_bwcacheuri.'])) {
    foreach ($typoscript['plugin.']['tx_bwcacheuri.']['settings.']['postProcessors.'] as $class => $postProcessor) {
        $GLOBALS['TCA']['tt_content']['columns']['dom_processor']['config']['items'][] = [
            $postProcessor['label'],
            substr($class, 0, -1)
        ];
    }
}

Version:
TYPO3 11.5.3

bw_cache_uri 1.1.3

news 10.0.3

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.