Author Archive

TYPO3 Ajax Page Configuration

ajax = PAGE
ajax {
  typeNum = 1234

  10 < plugin.myextension_pi1     

  config {
    disableAllHeaderCode = 1
    additionalHeaders = Content-type:application/json
    xhtml_cleaning = 0
    admPanel = 0
    debug = 0
    no_cache = 1
  }
}

Typo3 Inline Localiztion

'description' => array(
			'exclude' => 1,
			'label' => 'LLL:EXT:ext_product/Resources/Private/Language/locallang_db.xlf:tx_extproduct_domain_model_product.description',
			'config' => array(
				'type' => 'inline',
				'foreign_table' => 'tt_content',
				'minitems' => 0,
				'maxitems' => 999,
                'appearance' => array(
                    'collapseAll' => 1,
                    'expandSingle' => 1,
                    'levelLinksPosition' => 'bottom',
                    'useSortable' => 1,
                    'showPossibleLocalizationRecords' => 1,
                    'showRemovedLocalizationRecords' => 1,
                    'showAllLocalizationLink' => 1,
                    //'showSynchronizationLink' => 1,
                    'enabledControls' => array(
                        'info' => FALSE,
                    )
                )
			)
		),

mail spf

v=spf1 ip4:8.8.8.8 -all
v=spf1 +a +mx -all

http://www.openspf.org/SPF_Record_Syntax


Debian系Linux设置开机自启动命令update.rc.d

在Linux系统下,一个Services的启动、停止以及重启通常是通过/etc/init.d目录下的脚本来控制的。然而,在启动或改变运行级别时,是在/etc/rcX.d中来搜索脚本。其中X是运行级别的number。本文将解释如何启动、关闭和修改服务的运行。当你在Debian下安装一个新的服务,比如Apache2,安装完成后,默认情况下它会启动,并在下一次重启后自动启动。但是如果你不是一直需要这个服务,只在需要的时候启用它,你可以禁用它。 (continue reading…)


Cronjob backup www/mysql

www:

#!/bin/sh
#Backup
DIR_WWW_BAK="/data/backups/www"

#Web-Root
DIR_WWW="/var/www/vhosts/domain.net/"

#Webroot
DATUM2=`date '+%d-%m-%Y-%H:%M:%S'`
tar -czvf $DIR_WWW_BAK/domain.net-backup_webroot-${DATUM2}.tar.gz $DIR_WWW
#ncftpput -R -v -u "ftptest" -p "test" server.domain.com / $DIR
#ncftpput -R -v -u "ftptest" -p "test" server.domain.com / $DIR_WWW_BAK

#clear
find $DIR_WWW_BAK -name \*.tar.gz -mtime +3 -exec rm {} \;

Mysql:

#!/bin/sh
#Backup-db
DIR="/data/backups/mysql"

DATUM=`date '+%d-%m-%Y-%H:%M:%S'`

#backup
mysqldump -u dbusername --password='dbpassword' -h localhost dbname |gzip  -9 --best > $DIR/domain.net-backup-${DATUM}.sql.gz

#clear
find $DIR -name \*.sql.gz -mtime +7 -exec rm {} \;

Using UTF-8 characters on an e-mail subject

$to = 'example@example.com';
$subject = 'Subject with non ASCII ó¿¡á';
$message = 'Message with non ASCII ó¿¡á';
$headers = 'From: example@example.com'."\r\n"
.'Content-Type: text/plain; charset=utf-8'."\r\n";
mail($to, '=?utf-8?B?'.base64_encode($subject).'?=', $message, $headers);

Running Apache with a dozen PHP versions (mod_fcgid, mod_fastcgi)

fcgid:

install apache module: libapache2-mod-fcgid
*******************************************
AddHandler fcgid-script .php
Options +ExecCGI
FcgidWrapper /usr/local/php/php-wrapper-5.3.29 .php

      SetHandler fcgid-script

*******************************************
#!/bin/sh
# Set desired PHP_FCGI_* environment variables.
# Example:
# PHP FastCGI processes exit after 500 requests by default.
PHP_FCGI_MAX_REQUESTS=10000
export PHP_FCGI_MAX_REQUESTS

# Replace with the path to your FastCGI-enabled PHP executable
exec /usr/local/php/5.3.29/bin/php-cgi
*******************************************

/etc/apache2/mods-available/fcgid.conf 
FcgidConnectTimeout 600
FcgidMaxRequestLen 1024000000

(continue reading…)


Mac OS X取消Apache(httpd)开机启动

安装MAMP后,启动服务时提示Apache启动失败,80端口被占用.查看进程发现存在几个httpd. OS X自带Apache,可是默认是没有启动的.我也没有开启Web共享,怎么就开机启动了呢?

不知道是不是因为安装了别的什么软件导致的.一般的开机启动项可以在System Preferences–Users&Groups–Login Items中添加或删除.可是在这里也没有发现Apache相关的启动项.于是谷歌到了下面一个可行的方法,打开终端,执行下面的命令.

sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist
如果哪天你想让它开机启动了,则将unload 改为 load:

sudo launchctl load -w /System/Library/LaunchDaemons/org.apache.httpd.plist
launchd是Mac OS下,用于初始化系统环境的关键进程。类似Linux下的init, rc.此方法同样也适用于禁用系统的一些服务,比如打印机,蓝牙等.


Get File Relation

//Here is a small snippet I use to get uploaded images from a content object (tt_content).

public function getContentImages($tt_content_uid) {
    /** @var \TYPO3\CMS\Core\Resource\FileRepository $fileRepository */
    $fileRepository = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\CMS\Core\Resource\FileRepository');
    $fileObjects = $fileRepository->findByRelation('tt_content', 'image', $tt_content_uid);

    // Get file information
    $files = array();
    foreach ($fileObjects as $key => $value) {
        $file = array();
        $file['reference'] = $value->getReferenceProperties();
        $file['original'] = $value->getOriginalFile()->getProperties();
        $files[] = $file;
    }

    return $files;
}

How I can render Content Object from tt_content

In Extbase extensions $this->cObj is no more available in the current scope, so you need to get it firts before you can use:
In controller

/**
     * @param $pageUid
     * @param int $colPos
     * @return string
     */
    private function getTTContent($pageUid, $colPos = 0)
    {
        $contentObj = GeneralUtility::makeInstance(\TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::class);
        $conf['table'] = 'tt_content';
        $conf['select.'] = array(
            'pidInList' => $pageUid,
            'where' => 'colPos=' . $colPos
        );
        return $contentObj->cObjGetSingle('CONTENT', $conf);
        /*$tt_contents = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('uid', 'tt_content', 'deleted=0 and hidden=0 and pid=' . $pageUid . ' and colPos=' . $colPos . ' and sys_language_uid=' . $GLOBALS['TSFE']->tmpl->setup['config.']['sys_language_uid'], '', 'sorting asc');
        if (!empty($tt_contents)) {
            $contentObj = GeneralUtility::makeInstance(\TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::class);
            foreach ($tt_contents as $tt_content) {
                $conf['tables'] = 'tt_content';
                $conf['source'] = $tt_content['uid'];
                $tempContent .= $contentObj->cObjGetSingle('RECORDS', $conf);
            }
        }
        return $tempContent;*/
    }

 

$cObj = $this->configurationManager->getContentObject();
$ttContentConfig = array(
    'tables'       => 'tt_content',
    'source'       => 123,
    'dontCheckPid' => 1
);
$content .= $cObj->RECORDS($ttContentConfig);

In model.

/*
	 * get TT content
	 */
	public function getTTcontent($uids){
		$content = '';
		$tempArray = explode(",", $uids);
		$cObj = $GLOBALS['TSFE']->cObj;
		foreach($tempArray as $uid){
			$ttContentConfig = array(
				'tables'       => 'tt_content',
				'source'       => $uid,
				'dontCheckPid' => 1
			);
			$content .= $cObj->RECORDS($ttContentConfig);
		}
		return $content;
	}

lib.footer.social = RECORDS
lib.footer.social {
    source = 140
    dontCheckPid = 1
    tables = tt_content
}

 


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