How to set condition based upon template selection in fluid flux templating + typo3


Some time we need to set condition based upon template selection in fluid flux templating

Following script will help you more.

[globalVar = TSFE:page|tx_fed_page_controller_action = js_fuxtemplate->NewsLetter]

  YOUR CODE WILL BE HERE../.

[end]

Note: 
tx_fed_page_controller_action is stand for field name
js_fuxtemplate is stand for extension name
NewsLetter is stand for template name which are assign inside template

we can set some condition based upon other page field

i hope it will make you more happy πŸ™‚

If you have any queries, please do not hesitate to contact me at Jainish Senjaliya

How to readout an image in a Fluid template and give it a click enlarge function in DCE typo3 + FAL


How to wrap image with link in DCE + FAL

For set link around image with same resource you have to use “<f:uri.image>” following example will help you more.

Your fluid template gets an array of FileCollection models,

Following example will show you how to output several images from the FileCollection and wrap with link with same image resource

TCA Configuration for FAL – File Abstraction Layer

<config>
    <type>inline</type>
    <foreign_table>sys_file_reference</foreign_table>
    <foreign_field>uid_foreign</foreign_field>
    <foreign_sortby>sorting_foreign</foreign_sortby>
    <foreign_table_field>tablenames</foreign_table_field>
    <foreign_match_fields>
        <fieldname>gallery</fieldname>
    </foreign_match_fields>
    <foreign_label>uid_local</foreign_label>
    <foreign_selector>uid_local</foreign_selector>
    <foreign_selector_fieldTcaOverride>
        <config>
            <appearance>
                <elementBrowserType>file</elementBrowserType>
                <elementBrowserAllowed>gif,jpg,jpeg,tif,tiff,bmp,pcx,tga,png,pdf,ai</elementBrowserAllowed>
            </appearance>
        </config>
    </foreign_selector_fieldTcaOverride>
    <foreign_types type="array">
        <numIndex index="2">
            <showitem>--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,--palette--;;filePalette</showitem>
        </numIndex>
    </foreign_types>

    <minitems>0</minitems>
    <maxitems>99</maxitems>

    <appearance>
        <useSortable>1</useSortable>
        <headerThumbnail>
            <field>uid_local</field>
            <width>45c</width>
            <height>45</height>
        </headerThumbnail>

        <showPossibleLocalizationRecords>0</showPossibleLocalizationRecords>
        <showRemovedLocalizationRecords>0</showRemovedLocalizationRecords>
        <showSynchronizationLink>0</showSynchronizationLink>
        <useSortable>1</useSortable>
        <enabledControls>
            <info>1</info>
            <new>0</new>
            <dragdrop>0</dragdrop>
            <sort>1</sort>
            <hide>1</hide>
            <delete>1</delete>
            <localize>1</localize>
        </enabledControls>

        <createNewRelationLinkTitle>LLL:EXT:cms/locallang_ttc.xlf:images.addFileReference</createNewRelationLinkTitle>
    </appearance>

    <behaviour>
        <localizationMode>select</localizationMode>
        <localizeChildrenAtParentLocalization>1</localizeChildrenAtParentLocalization>
    </behaviour>
</config>

Template content (fluid)

<f:for each="{dce:fal(field:'gallery', contentObject:contentObject)}" as="fileReference" iteration="iterator" >
   <a href='<f:uri.image src="{fileReference.uid}" treatIdAsReference="1" />'  rel="gallery" title="" class="fancybox" >
       <f:image src="{fileReference.uid}" alt="" treatIdAsReference="1" class="icon" />
   </a>
</f:for>

The loop run through the complete FAL image list.

The if condition in the treatIdAsReference is recommended because FileCollections returns different types of objects depending of the type of the collection.

Folder based collections returns the file directly, static based collections a file reference. With this condition both cases are covered.

This was for FAL – File Abstraction Layer.

Now we look for simple upload image [ Systems file collections ]

If you have use file collections and you have defined a field in DCE where you can select images than you can access the file name in the Fluid template.

The location where the image is stored is also defined in the TCA, which is mostly something like uploads/pics.

TCA Configuration for simple file upload

<config>
    <type>group</type>
    <internal_type>db</internal_type>
    <allowed>sys_file_collection</allowed>
    <size>5</size>
    <minitems>0</minitems>
    <maxitems>999</maxitems>
    <show_thumbs>1</show_thumbs>
    <dce_load_schema>1</dce_load_schema>
</config>

Note : Since version 0.11.x of DCE you are. Just add a group field, set allowed tablename to “sys_file_collection” and add the dce_load_schema option.

In the Fluid template you can write following script:

<a href="{f:uri.image(src:'uploads/pics/{field.yourPicture}')}" >
    <f:image src="uploads/pics/{field.yourPicture}" alt="" maxWidth="150" maxHeight="150" />
</a>

I hope this will work for you πŸ™‚

If you have any queries, please do not hesitate to contact me at Jainish Senjaliya

How to remove controller and action from realurl + typo3 extbase


This is very important part for SEO Base URL. So we must need to short URL.

We can remove the controller or the action in the RealURL config.

Following should do the trick, which will removes both action and controller from a detail-link.

'faq' => array(
    array(
        'GETvar' => 'tx_jsfaq_faq[action]',
        'valueMap' => array(
            'detail' => '',
        ),
        'noMatch' => 'bypass'
    ),
    array(
        'GETvar' => 'tx_jsfaq_faq[controller]',
        'valueMap' => array(
            'detail' => '',
        ),
        'noMatch' => 'bypass'
    ),
    array(
        'GETvar' => 'tx_jsfaq_faq[faq]',
        'lookUpTable' => array(
            'table' => 'tx_jsfaq_domain_model_faq',
            'id_field' => 'uid',
            'alias_field' => 'question',
            'addWhereClause' => ' AND NOT deleted',
            'useUniqueCache' => 1,
            'useUniqueCache_conf' => array(
                'strtolower' => 1,
                'spaceCharacter' => '-',
                ),
            'autoUpdate' => 1,
        ),
    ),
),	

I hope this will help you more. nojy πŸ˜‰

If you have any queries, please do not hesitate to contact me at Jainish Senjaliya

How to set logo dynamic in typo3.


If you want to set logo dynamic then you have to set your in your page [in root page]

Edit your root page :

Edit page -> Resources -> Files – Media ->

Edit Logo Typo3  4.X.XX Version

Edit Logo Typo3 4.X.XX Version

TYPO3 4.x.xx Version – PI BASE
Below script will use in 4.7.XX and below then 4.7.XX version.

lib.logo = COA
lib.logo{

  29 = IMG_RESOURCE
  
  29.file.import {
    cObject = TEXT
    cObject.value = dummy.gif
    cObject.override {
      required = 1
      data = levelmedia: -1, slide
      wrap = uploads/media/|
      listNum = 0
    }
  }
  # 29.file.width = 202
  # 29.file.height = 22
}
  
lib.logo.wrap = <a href='index.php'><img src="|" alt="" /></a>

TYPO3 6.x.xx Version – FLUID

Edit your root page :

Edit page -> Resources -> Media -> Create new relation

Edit Logo Typo3  6.X.XX Version

Edit Logo Typo3 6.X.XX Version

Below script will use in 6.X.XX version.

lib.logo = COA
lib.logo {
  10 = IMAGE
  10 {
      file {
        import =  uploads/media/
        import.data = levelmedia:-1, slide
        import.listNum = 0
        treatIdAsReference = 1
      }
      titleText.data = page:subtitle
      altText.data = page:subtitle
      stdWrap.typolink.parameter.data = leveluid:0
  }
}

Note: you have to map your logo html with “lib.logo” object.

If you have any queries, please do not hesitate to contact me at Jainish Senjaliya