How to crop string in typo3 extbase and pi base


 
Following function will crop a string and also append three dots to string.

fixed_lgd_cs($strings,$chars);

$char variable indicates the length.
$stringsvariable indicates the string.

For Example :

$strings = "I am a TYPO3 & PHP Developer";
$chars = 6;

Below function is for PI base. Will work till TYPO3 4.7.XX Version.

$data = t3lib_div::fixed_lgd_cs($strings,$chars); 
echo $data;

Output Will be :

I am a...

It will automatically append three dots at end of the string.

if we use negative number then it will crop that amount of character at end of the string.

Like :

$chars = -9;

Then output Will be :

...Developer

It will automatically append three dots at beginning of the string.

Above script will work for PI base only.

If you want to set this function in ext base fluid then simple you have to use “\TYPO3\CMS\Core\Utility\GeneralUtility” instead of “t3lib_div“.

Following function will work for TYPO3 6.x.xx

$data = \TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($strings,$chars);

I hope it will work for you 🙂

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

Basic configuration of typo3


config {
htmlTag_setParams = xmlns=”http://www.w3.org/1999/xhtml” xml:lang=”de” lang=”de”
doctype = html5
# to get MSIE working in “standardsmode”
xmlprologue = none

disablePrefixComment = 1
disableImgBorderAttr = 1

inlineStyle2TempFile = 1

pageTitleFirst = 1

baseURL = {$baseURL}
tx_realurl_enable = 0

simulateStaticDocuments = 0

index_enable = 1
index_externals = 1

pageTitleFirst = 1

no_cache = 0
prefixLocalAnchors= cached
sys_language_overlay = hideNonTranslated
# sys_language_overlay = content_fallback

# set the defaultcharset
renderCharset = utf-8
metaCharset = utf-8

notification_email_charset = utf-8
xhtml_cleaning = 1
linkVars = L
sys_language_uid = 0

uniqueLinkVars = 1
language = nl
locale_all = nl_NL
htmlTag_langKey = nl-NL
htmlTag_dir = ltr

# Spam protection
spamProtectEmailAddresses = -3
spamProtectEmailAddresses_atSubst = (at)
spamProtectEmailAddresses_lastDotSubst = .
}

How do I remove p tags in typo3 RTE text content elements


 
Many of user want to remove extra p tag which are generate automatically by TYPO3.

Following script will definitely helping you.

tt_content.stdWrap.dataWrap >
lib.parseFunc_RTE.nonTypoTagStdWrap.encapsLines >

Remove Class “bodytext” in p tag : <p class=”bodytext”>

lib.parseFunc_RTE.nonTypoTagStdWrap.encapsLines.addAttributes.P.class =

OR 

lib.parseFunc_RTE.nonTypoTagStdWrap.encapsLines.addAttributes.P.class >

Fnally you getting rid of p tag 😉

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

How to getting rid of extra markup in TYPO3


TYPO3 generate extra HTML code while we display conetent from content element.

For example:
if you put content elements on a TYPO3 page then by default the source code looks like following

<a id="c143"></a>
<div class="csc-header csc-header-n1">
  <h3 class="csc-firstHeader">This is the First Header</h3>
</div>
<p class="bodytext">This is the first paragraph</p>

This is all fine and dandy, but maybe you don’t need all of these extra classes and anchors.
Fortunately, TYPO3 core team has accomodated for that as well.

Try below code in your TypoScript template. Following should do the trick.

 lib.parseFunc_RTE.nonTypoTagStdWrap.encapsLines.addAttributes.P.class >
 lib.stdheader.stdWrap.dataWrap >
 lib.stdheader.3.headerClass >
 tt_content.stdWrap.dataWrap >

The resulting output of HTML code for the content elements will look like below.

    <h3>This is the First Header</h3>
    <p>This is the first paragraph</p>

you can also use following code to simply modify the code instead of eliminating it. For instance,

    lib.parseFunc_RTE.nonTypoTagStdWrap.encapsLines.addAttributes.P.class = my-style

will change

    <p class="bodytext">This is the first paragraph</p>

to this:

    <p class="my-style">This is the first paragraph</p>

I hope it will work for you 🙂

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

How to remove figure tag html in image wrap of typo3.


When we use images in media element of typo3 extbase that time extra figure html tag is generated automatically.

<figure class="csc-textpic-image csc-textpic-last"><img width="141" height="105" title="Search o mania" alt="Search o mania" src="fileadmin/templates/img/Search-o-mania.jpg"></figure>

If you donot want it figure html tag then simply use below script in your setup file.

tt_content.image.20.renderMethod = figure
tt_content.image.20.rendering.figure

I hope now you get rid of figure tag 🙂 😉

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

Sorry, you didn’t have proper permissions to perform this change + Typo3 4.7 TemplaVoila


 
After installing TemplaVoia. and i try to add page content element on page. that time i suddenly received is :

“Sorry, you didn’t have proper permissions to perform this change.”

The following SQL should do the trick and also fixed your problem.

ALTER TABLE pages ADD t3ver_swapmode tinyint(4) NOT NULL default '0'

I hope it will work for you 🙂

Because of this issue your template may not render on front end side.

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