Author Archive

Mysql主从同步配置

1、Introduction

之前写过一篇文章:Mysql主从同步的原理。

相信看过这篇文章的童鞋,都摩拳擦掌,跃跃一试了吧?

今天我们就来一次mysql主从同步实战! (continue reading…)


FEATURE SPOTLIGHT: LINKHANDLER

PageTSconfig – Make records appear in the link browser

To add a new type of records to the link browser you have to add a few lines of PageTSconfig to the system. Under TCEMAIN.linkHandler you can add new tabs with unique identifiers. By using the TYPO3\CMS\Recordlist\LinkHandler\RecordLinkHandler the link browser knows that the new tab cares about some kind of records. It is possible to add custom LinkHandler since TYPO3 7 LTS (see feature RST). Of course you have to configure the table that stores the records. Other than that you have a few additional options:

TCEMAIN.linkHandler.tx_news {
    handler = TYPO3\CMS\Recordlist\LinkHandler\RecordLinkHandler
    label = News
    configuration {
        table = tx_news_domain_model_news
        storagePid = 164
        hidePageTree = 1
    }
    scanAfter = page
}

 

  • The label can also be a reference to a locallang file (LLL:EXT:...).
  • If hidePageTree is set to 1 the page tree will not be rendered in this link browser tab.
  • If the storagePid is set this page will be rendered when the tab is opened first.
  • If any pageTreeMountPoints are set, those are rendered instead of the normal page tree.
  • The scanAfter (or scanBefore) option defines the order in which handlers are queried when determining the responsible tab for an existing link.
  • The position of the tab can be altered with the option displayAfter (or displayBefore).

The 2nd part of the configuration is concerned with the frontend rendering of the links to the records. So let’s have a look at the TypoScript.

Top 

TypoScript – Tell the Frontend what to do

With the PageTSconfig from above it is now already possible to add links in a RTE. This will create something like <a href="t3://record?identifier=tx_news&amp;uid=2">News</a> in the database. And when this is rendered in the frontend you need to make sure that TYPO3 knows how to resolve the t3://record?identifier=tx_news link. You tell TYPO3 in its favorite language: TypoScript.

config.recordLinks.tx_news {
    typolink {
        parameter = {$myConstants.newsDetailPid}
        additionalParams.data = field:uid
        additionalParams.wrap = &tx_news_pi1[news]=|
        useCacheHash = 1
    }
}
Under config.recordLinks you have to register the same identifier you used in the PageTSconfig. Of course you need to tell TYPO3 on what page the record should be rendered, how to pass the uid and what other parameter need to be added to the URL. You could add 
config.recordLinks.tx_news.forceLink = 1

to force even links to hidden records.

And that is all you have to do.

From: https://usetypo3.com/linkhandler.html


Typo3 Head, Body Tag extend

page.headTag.stdWrap.cObject = COA
page.headTag.stdWrap.cObject{
    5 = TEXT
    5.value = <head>
    10 = TEXT
    10.value(
xxxx
    )
}
page.bodyTagCObject = COA
page.bodyTagCObject{
    5 = TEXT
    5.value = <body>
    10 = TEXT
    10.value(
xxxx
    )
}

 


Postfix und Courier mit TLS und SSL und Antispam (also STARTTLS, IMAPS, POP3S und DNSBL) unter Debian

nachdem die Default-Installation ja ein wenig mager in Sachen Verschlüsselung ist, habe ich die Freiheit von Froxlor genutzt, um ein paar Anpassungen vorzunehmen.

(continue reading…)


Typo3 set page title in plugin

 

/**
     * set page title
     * @param $title
     */
    public static function setPageTitle($title){
        GeneralUtility::makeInstance(ObjectManager::class)->get(\TYPO3\CMS\Core\Page\PageRenderer::class)->setTitle($title);
        // For the search
        $GLOBALS['TSFE']->altPageTitle = $title;
        $GLOBALS['TSFE']->indexedDocTitle = $title;
    }

 


iOS推送功能实现步骤

1. app端推送证书等配置文件的创建;

2. php推送服务器ssl证书的创建;

(continue reading…)


Typo3 xlf/xml translation

xlf:

/** @var $languageFactory LocalizationFactory */
        $languageFactory = GeneralUtility::makeInstance(LocalizationFactory::class);
        $LOCAL_LANG = $languageFactory->getParsedData('EXT:sitebase/Resources/Private/Language/locallang.xlf', 'en', 'utf-8');
xml:

public function getTranslate($file, $key, $lang)
    {
        $xml = GeneralUtility::xml2array(file_get_contents($file));
        if (isset($xml['data'][$lang][$key])) {
            return $xml['data'][$lang][$key];
        } else {
            return $xml['data']['default'][$key];
        }
    }

 


Typo3 extend page cache

HOOKS:

$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_fe.php']['createHashBase']['currency'] = 'EXT:sitebase/Classes/Hooks/HashHook.php:' . 'Top\\Sitebase\\Hooks\\HashHook->makeHash';







MAC上通过brew安装PHP7

升级brew

brew update
配置

(continue reading…)

1 Comment more...

mysql 5.7 group by order by

It seems that all ORDER BY will be ignored if they stand in sub-query before GROUP BY in mysql 5.7.

I have the same issue in my query. I found work-around. You can add "ORDER BY" by key column. If id is primary key in your table, you can add

GROUP BY `id`
before

ORDER BY FIELD(lang, 'EN', 'JP')
Query:

`SELECT *
FROM
(
  SELECT  `id`, `category`, `name`, `number`, `lang`
  FROM `test`
  WHERE `category` = 'Cat1'
  GROUP BY `id`
  ORDER BY FIELD(lang, 'EN', 'JP')
) as table
GROUP BY number
ORDER BY number DESC`

Copyright © 1996-2010 Add Lives. All rights reserved.
iDream theme by Templates Next | Powered by WordPress