I tried to change the MaxGalleryWidth in fluid_styled_content for an specific column.
First I tried how I do this before fluid_styled_content:
lib.contentRight = COA
lib.contentRight {
10 = LOAD_REGISTER
10 {
maxImageWidth = 205
maxImageWidthInText = 60
}
20 < styles.content.get
20 {
select {
where = colPos=1
}
slide = -1
}
90 = RESTORE_REGISTER
}
Also using maxGalleryWidth in LOAD_REGISTER has no effect.
This doesn't work for me. Than I tried to set the maxGalleryWidth Parameter for the GalleryProcessor, but this seems not to have any effect:
lib.contentRight < styles.content.get
lib.contentRight {
select {
where = colPos=1
}
slide = -1
renderObj = < tt_content
renderObj.textmedia.dataProcessing.20 {
maxGalleryWidth = 205
maxGalleryWidthInText = 60
}
}
Finaly I got it only to work with an override and if condition:
tt_content.textmedia.dataProcessing.20 {
maxGalleryWidth.override.cObject = TEXT
maxGalleryWidth.override.cObject {
value = 205
if {
value = 1
equals.field = colPos
}
}
maxGalleryWidthInText.override.cObject = TEXT
maxGalleryWidthInText.override.cObject {
value = 60
if {
value = 1
equals.field = colPos
}
}
}
For me it looks wrong, are there other ways to realize it correctly without using override?
Related
I get the images for a slider via data = level media:-1,slide
On a news-single-page I want to use the news-images instead of. So I put the code for this in conditions [globalVar = GP:tx_news_pi1|news > 0] and get the images of the news. All ok. But I want to show the level media, if there is no news-image. How can I do this?
Here’s the TypoScript:
lib.keyVisual = COA
lib.keyVisual {
10 = FILES
10 {
references {
data = levelmedia:-1,slide
}
renderObj = COA
renderObj.10 = IMAGE
renderObj.10 {
file {
import.data = file:current:uid
treatIdAsReference = 1
width = {$keyVisualWidth}
#width.field >
height = {$keyVisualHeight}
}
}
renderObj.20 = COA
renderObj.20 {
1 = TEXT
1 {
data = file:current:title
required = 1
wrap = <h3>|</h3>
}
2 = TEXT
2 {
data = file:current:description
required = 1
wrap = <p>|</p>
}
stdWrap.wrap = <div class="imageCaptionBox">|</div>
stdWrap.required = 1
}
renderObj.wrap = <li>|</li>
}
wrap = <section id="keyvisual" class="keyvisual fullWidth"><ul class="slider nav">|</ul></section>
}
[globalVar = GP:tx_news_pi1|news > 0]
lib.keyVisual {
10 {
references {
data >
table = tx_news_domain_model_news
uid.data = GP:tx_news_pi1|news
fieldName = fal_media
}
# only images with showinpreview
renderObj.if {
value = 1
equals.data = file:current:showinpreview
}
}
}
[global]
Work with the ifEmpty stdWrap option.
If your COA is empty you can render the default image with this option.
simple example to explain:
[globalVar = GP:tx_news_pi1|news > 0]
lib.keyVisual {
stdWrap.ifEmpty.cObject < .10
#overrides for news picture
10 {
...
}
}
[global]
all conditions have an [else] so you do not need to redefine.
[globalVar = GP:tx_news_pi1|news > 0]
lib.keyVisual {
... from news...
}
[else]
lib.keyVisual {
... from levelmedia ...
}
[global]
then you need to distinguish wether an image is availabel for the news.
[globalVar = GP:tx_news_pi1|news > 0]
lib.keyVisual = COA
lib.keyVisual {
10 = CONTENT
10 {
// get news record and then get file
... from news...
if.empty.field = media
}
20 = FILES
20 {
... from levelmedia ...
if {
empty.field = media
negate = 1
}
}
}
[else]
lib.keyVisual {
... from levelmedia ...
}
[global]
that could be optimized by using a temp object for the levelmedia usage which gets copied.
temp.levelmediaImage {
...
}
[globalVar = GP:tx_news_pi1|news > 0]
kib.keyVisual = COA
lib.keyVisual {
10 = CONTENT
10 {
// get news record and then get file
... from news...
if.empty.field = media
}
20 < temp.levelmediaImage
20 {
if {
empty.field = media
negate = 1
}
}
}
[else]
lib.keyVisual < temp.levelmediaImage
[global]
I need help with image processing configuration in Typo3 7.6.4. All images are being processed no matter how big they are. That causes that the images are not in original size and unsharp, renamed and copied in processed folder. I would like to configure image processing so that it is activated only if images have some specific size (px or kb/mb). For example if image have more than 1MB or if the is width more than 800px, than processed it otherwise leave it as it is and link to original file (no copy, no processing). Thanks
page.10 = FLUIDTEMPLATE
page.10 {
template = CASE
template {
key.data = levelfield:-1,backend_layout_next_level,slide
key.override.field = backend_layout
1 = FILE
1.file = fileadmin/templates/sitename/main_1_column.html
2 = FILE
2.file = fileadmin/templates/sitename/main_2_column.html
}
partialRootPath = fileadmin/templates/sitename/partials/
layoutRootPath = fileadmin/templates/sitename/layouts/
variables {
siteName = TEXT
siteName.value = sitename
header < styles.content.get
header.select.where = colPos = 0
contentMain < styles.content.get
contentMain.select.where = colPos = 1
content_column_1 < styles.content.get
content_column_1.select.where = colPos = 1
content_column_2 < styles.content.get
content_column_2.select.where = colPos = 2
footer < styles.content.get
footer.select.where = colPos = 3
}
}
tt_content {
stdWrap {
innerWrap {
cObject {
default.20.40 = CASE
default.20.40 {
key.field = layout
default = TEXT
default.value = img-responsive
}
}
}
innerWrap2 >
}
image {
20 {
1 {
params.cObject = TEXT
params.cObject {
wrap = class="|"
cObject < tt_content.stdWrap.innerWrap.cObject.default.20.40
}
sourceCollection >
sourceCollection {
big {
maxW = 5000
dataKey = big
}
small {
maxW = 500
dataKey = small
}
smallLandscape {
maxW = 800
dataKey = smallLandscape
}
}
}
maxW = 5000
}
}
}
I have the following menu-type, which works correctly for the main-part.
However, i want to add a fallback image, if no image is found.
tt_content.menu {
20 {
108 = HMENU
108 {
special = directory
special.value.field = pages
1 = TMENU
1.wrap = <div class="special_menu">|</div>
1.NO {
doNotLinkIt = 1
stdWrap.cObject = COA
stdWrap.cObject {
10 = FILES
10 {
references {
table = pages
fieldName = media
}
renderObj = IMAGE
renderObj {
file {
width = 263c
height = 155c
maxW = 263c
maxH = 155c
import.data = file:current:publicUrl
# if file:current:publicUrl is empty, use default image
if.isFalse = fileadmin/my/path/to/image.jpg
}
altText.field = title
imageLinkWrap = 1
imageLinkWrap {
enable = 1
typolink.parameter.field = uid
}
}
stdWrap.wrap = <div class="menu10_bild">|</div>
}
20 = TEXT
20.field = title
20.typolink.parameter.field = uid
20.wrap = <div class="menu10_text">|
30 = TEXT
30.field = abstract
30.wrap = <p>|</p></div><div class="w-clearfix"> </div>
}
}
}
}
}
for some reason, it just ignores the line. Can someone help me with that?
You should check the TypoScript Reference stdWrap.ifEmpty.
In your case the code should look like this
tt_content.menu {
20 {
108 {
1.NO {
stdWrap.cObject {
10 = FILES
10 {
# ....
stdWrap.ifEmpty.cObject = IMAGE
stdWrap.ifEmpty.cObject{
file = fileadmin/.../my_image.png
}
# ....
}
}
}
}
}
}
You can use every cObject you want.
Check out Content Objects (cObject)
Try this:
tt_content.menu {
20 {
108 = HMENU
108 {
special = directory
special.value.field = pages
1 = TMENU
1.wrap = <div class="special_menu">|</div>
1.NO {
doNotLinkIt = 1
stdWrap.cObject = COA
stdWrap.cObject {
# default image
value = fileadmin/my/path/to/image.jpg
10 = FILES
10 {
references {
table = pages
fieldName = media
}
renderObj = IMAGE
renderObj {
file {
width = 263c
height = 155c
maxW = 263c
maxH = 155c
import.data = file:current:publicUrl
}
altText.field = title
imageLinkWrap = 1
imageLinkWrap {
enable = 1
typolink.parameter.field = uid
}
}
stdWrap.wrap = <div class="menu10_bild">|</div>
}
20 = TEXT
20.field = title
20.typolink.parameter.field = uid
20.wrap = <div class="menu10_text">|
30 = TEXT
30.field = abstract
30.wrap = <p>|</p></div><div class="w-clearfix"> </div>
}
}
}
}
}
In a COA, I have this TypoScript to add an image linked to a larger copy of itself. But the Javascript plugin I'm using (Colorbox) isn't able to resize the image properly.
20 = CONTENT
20 {
wrap = <div class="lightbox clearfix">|</div>
required = 1
table = tt_content
select.languageField = sys_language_uid
select.where = colPos = 2
select.selectFields = bodytext,image,header
renderObj=COA
renderObj{
10 = FILES
10 {
required = 1
references {
table = tt_content
fieldName = image
}
renderObj = IMAGE
renderObj {
file.import.data = file:current:originalUid // file:current:uid
file.width=300c
file.height=300c
imageLinkWrap = 1
imageLinkWrap {
enable = 1
width = 1600m
height = 1600m
JSwindow = 0
linkParams.ATagParams {
// title.data =
dataWrap = class = "lightbox-group" title="{file:current:description}"
}
}
}
}
}
}
What's up?
Here's the correct TypoScript. I'm sharing it because it is a legacy weirdness others might stumble upon too.
You have to set imageLinkWrap.directImageLink = 1, else imageLinkWrap won't deliver the image itself, but a HTML page containing that image!
20 = CONTENT
20 {
wrap = <div class="lightbox clearfix">|</div>
required = 1
table = tt_content
select.languageField = sys_language_uid
select.where = colPos = 2
select.selectFields = bodytext,image,header
renderObj=COA
renderObj{
10 = FILES
10 {
required = 1
references {
table = tt_content
fieldName = image
}
renderObj = IMAGE
renderObj {
file.import.data = file:current:originalUid // file:current:uid
file.width=300c
file.height=300c
imageLinkWrap = 1
imageLinkWrap {
enable = 1
width = 1600m
height = 1600m
directImageLink = 1
JSwindow = 0
linkParams.ATagParams {
// title.data =
dataWrap = class = "lightbox-group" title="{file:current:description}"
}
}
}
}
}
}
i've configured typo3 to enable a multi-line navigation title. So if there is a linebreak there should be also a linebreak in the menu-link.
I'm splitting the Text with the following code
30 = COA
30.10 = TEXT
30.10 {
field = {nav_title//title}
listNum = 0
listNum.splitChar = 13
}
30.20 < .30.10
30.20.listNum = 1
30.20.wrap = <br />|
30.20.required = 1
My Menu-Creation basicily the following
1 = TMENU
1.expAll = 1
1.NO {
doNotLinkIt = 1
stdWrap.override.cObject =TEXT
stdWrap.override.cObject {
typolink.parameter.field = uid
if.isTrue.numRows {
table = tt_content
select {
pidInList.field = uid
where = colPos = 0
}
}
}
}
The stdWrap.override-Block disables clickable links if the page if there is no content for the page.
Now to my question: It feels that i'm too dumb to merge those parts - How is it done the right way?
Guessing, untested:
1 = TMENU
1.expAll = 1
1.NO {
doNotLinkIt = 1
stdWrap.override.cObject = COA
stdWrap.override.cObject {
10 = TEXT
10 {
field = {nav_title//title}
listNum = 0
listNum.splitChar = 13
}
20 < .30.10
20 {
listNum = 1
wrap = <br />|
required = 1
}
typolink.parameter.field = uid
if.isTrue.numRows {
table = tt_content
select {
pidInList.field = uid
where = colPos = 0
}
}
}
}