Code Snippets
MySQL Insert many records with a string with incrementation values
A way to insert many records with incrementing names for testing purposes.
Keywords: procedureincrementnamesinsert
CakePHP Solved problem with login (Auth)
If you use languages in your routes it is sometimes a little bit complicated to get your login action working.
Keywords: authloginloginActionlanguageparams
CakePHP Use (My)SQL functions in save action
Sometimes it is necessary to use SQL statements in your cakePHP save action, but CakePHP usually escapes everything when saving. This code helps to prevent your statements from beeing escaped.
Keywords: mysqlstatementdateintervalnow()saveescape
MySQL MySQL condition for empty fields
Select different fields for select using a condition
Keywords: mysqlselectcondition
Apache Optimise performance using expire and deflate
Improve the page load performance of your website by adding long life expire dates to your static files.
Keywords: htaccessmod_deflatemod_expireperformanceload
PHP Extract file extension from filename
Small function to extract the extension of a file from a given filename
Keywords: fileextensionextractgetfilename
Typo3 Show specified content element
Typoscript to show a content element with given id.
Keywords: typoscriptcontenttt_contentelementrecordssource
Typo3 Page tree condition for configuration of a page and everything below this page
Page tree condition for configuration of a page and everything below this page
Keywords: typoscriptconditionpagepagetreepidtsfeglobalvar
Typo3 Hide select icons for database relation in backend
If you create an extension in kickstarter with related table dropdown, you'll get a set of hidden icons for each select option. If you do not want them to appear in backend, you need this code snippet.
Keywords: pluginextensiontcasuppressiconshideiconkickstarter
MySQL Insert with content of another table
Keywords: insertselect
Typo3 Do not hide plugins on copy / prevent copy from new "copy x" title
With this snippet you could control, if copied plugins should be hidden or not and which text should be prepended to title of the copied element.
Keywords: pluginextensioncopyext_tableshiddenhidecopytexttcaprependAtCopyhideAtCopylocallang
PHP Cut text after last space inside of limited length
Keywords: textcutlimitsubstrspace
MySQL MySQL requests with regular expressions
Keywords: regexpregularexpressionselect
MySQL Change database to utf8
Keywords: databasealterutf8
CakePHP SQL query with virtual fields
Sometimes it is neccessary to retrieve your data via the "query" function of CakePHP with plain SQL, e.g. for requests with subselects for correct data while grouping and sorting. To urge this data into the "normal" data array you need to use virtual fields definition.
Keywords: virtualFieldsgroupsumavgquerysubselect
MySQL Get an alphabet of all elements
Useful for glossary anchors or something else. It retrieves the first letter of each entry and groups by it.
Keywords: firstletteralphabetglossary
MySQL Get localised month names from MySql
Retrieves localised month names any given date in (My)SQL
Keywords: monthlocalisedlocalisationlc_time
Typo3 Images in Extension
Two ways to use Typo3 resize and crop functions for images in your extension/plugin.
Keywords: extensionpluginimageresizecroprenderpath
Typo3 Get the Record Storage Page ids of plugin
Keywords: extensionpluginpagespidrecursivegetPidList
Typo3 Get all PIDs in tree of specified page
This function retrieves all page ids below the given tree root.
Keywords: extensionplugingetPidListpidtreerecursivepages
Typo3 Render extension content with css_styled_content
Just a function to use for rendering extension/plugin content inserted with RTE.
Keywords: extensionpluginrendercontentRTEcssTextformat
Typo3 Get content from specified column
A quick and small way to get the content of a specified column with css_styled_content. Good to read content of the new Typo3 4.5 Backend Layout feature.
Keywords: typoscriptstylescontentcss_styled_contentcolumncolPosselect
Typo3 Show extension data in page mode
Sometimes it is useful to show the content of a plugin in page mode of Typo3. The benefit is a better usability for editors.
Keywords: extensionpluginpagepagemodebackend
Typo3 Different wrap methods for tt_content
Keywords: typoscripttt_contentwrapstdWrapdataWrapouterWrapinnerWrapcasesection_framelayoutcType
Typo3 Configure Meta Tags in Typo3
With this snippet you can define default keywords and description for pages without these. Otherwise the keywords and description defined in page configuration will be used.
Keywords: typoscriptpluginmetatagsrobotsdescriptionkeywordsrevisit
Typo3 Render content elements in extension
This function renders content elements specified by an array of uids as css_styled_content would render. With this function you could insert content elements in your extension.
Keywords: extensiontt_contentrender
Typo3 404 Not found redirect
Redirects to configured page. This page could be a typo3 page too.
Keywords: localconf.phpredirect404errorpage
Typo3 Transform special chars in links for validation issues
To improve the w3c validation of your page you need to activate the transformation of special chars (like & to &) in links and menus.
Keywords: typoscriptmenulinkspecialcharsvalidationvalidate
MySQL Sort result with a specified sort list
Very useful if there is a WHERE field IN (values) condition. The values could be used in the same way for the sorting definition.
Keywords: sortingspecialfields
Typo3 Simple link with typoscript
Keywords: typoscriptlinktypolinkatagparams
PHP Localisation for date functions
Localise the output of date functions for months and days
Keywords: localisationlocaliselocalizationlocalizedatestrftimesetlocalelc_time
Typo3 Condition for all elements with page id in rootline / tree
Keywords: typoscriptconditionpidPIDInRootline
Typo3 Get PIDs from "Record Storage Page" selector
Get PIDs of selected pages from "Record Storage Page" selector in plugin inclusion.
Keywords: pluginextensioncobjpidpages
Typo3 List of all possible menu status
Just a listing of all possible menu status you can use for menu generation in typoscript.
Keywords: typoscriptmenustatusstatiNOIFSUBACTACTIFSUBCURUSRSPCCURROCURIFSUBCURIFSUBROACTROACTIFSUBRO
Typo3 Create a "switch language" menu (variant 2)
Another way to create a switch language menu with active status of the current language. In this variant you could set different settings for all links for each selected language.
Keywords: typoscriptswitchlanguagemenuactive
Typo3 Create a "switch language" menu (variant 1)
How to create a switch language menu with active status of the current language.
Keywords: typoscriptswitchlanguagemenuactive
Typo3 How to use user functions
Small snippet to retrieve content from user functions in extensions.
Keywords: typoscriptuserfuncfunctionextensionplugin
Typo3 Plain and empty template
Useful to generate RSS or AJAX content pages.
Keywords: typoscripttemplateemptyplainrssajax
Typo3 Include typoscript from file
Script to include typoscript from file. Useful for versioning.
Keywords: typoscriptincludeexternalfile
Typo3 Show navigation title only in pagetree
The page tree is sometimes very confusing if you define navigation title and page title for your pages. With this code you could show the navigation title only.
Keywords: typoscriptlocalconf.phpnavtitleTSconfig
Typo3 Get translation for current language from locallang.xml
Reads translated string from locallang.xml for current language selection. If there is no translation, the default string would be returned.
Keywords: pluginextensionlanguagelocallangtranslate
Typo3 Get current language key in extension
Sometimes you need to get the current language key in your extension.
Keywords: pluginextensionlanguagekey
Typo3 Get current sys_language_uid in extension
Sometimes you need to get the current sys_language_uid in your extension.
Keywords: pluginextensionsys_language_uidtsfelanguage
Typo3 Basic page config for multi domains / multi languages
Initial configuration for baseUrl and language meta tags for multi domain and multi language pages.
Keywords: typoscriptmultilanguagedomainconfigmeta
Typo3 Change plugin texts with typoscript
Change plugin texts with typoscript. You can do this for multi language texts too.
Keywords: typoscriptmultilanguagetextpluginextension
Typo3 Multi language texts with typoscript
A way to define multi language texts in typoscript
Keywords: typoscriptmultilanguagetext
Typo3 HTML template into Typo3 content element
Loads a HTML template part into a Typo3 content element.
Keywords: typoscripttemplatecontentcoa
Apache Redirect domain to www.domain
Redirects domain requests without www to www.domain with 301 status code (for search engines). This prevents from the problem of providing duplicate content.
Keywords: redirecthtaccessmod_rewrite301
Typo3 Show layout field in plugin content item
Sometimes you need the layout dropdown for the plugin content item too.
Remove entry "layout" in ext_tables.php "subtypes_excludelist". This list could be used to hide some other elements too.
Keywords: layoutpluginextensionext_tablesexcludelisttt_content
Typo3 Rendering Typo3 Link URLs within Extension
Retrieves URL for specified page id (pid). $GLOBALS['TSFE']->id contains current page id.
Keywords: typolinkgetpagelinkextensionpluginurltsfe
Typo3 Rendering Typo3 Links within Extension
How to render a Typo3 link. $myPageId could be replaced with $GLOBALS["TSFE"]->id if you want to render a link to current page. $this->pi_getLL('your-translation-key') translates your link name and link title based on your locallang.xml file.
Keywords: typolinklinktopageatagparamstranslationextensionplugintsfe
Typo3 Typoscript condition for special page
Condition to define typoscript for selected/exclusive pages of a specified pagetree/rootpage only.
Keywords: typoscriptconditiontsfeidglobalvarpagetreerootpage
Typo3 Typoscript condition for special page
Condition to define typoscript for selected/exclusive pages only.
Keywords: typoscriptconditiontsfeidglobalvar
MySQL Update table with content of another table
If you need to import content from another table width different field names.
Keywords: insertjoinmigrateimport