I try to set the max image size for a specific content element. How can I do this for the element "content"? I tried to combine several options, but nothing works.
Is the content.maxImageWidthInText.maxH the right way?
Here is my code:
page = PAGE
page {
typeNum = 0
10 = FLUIDTEMPLATE
10 {
file.stdWrap.cObject = CASE
file.stdWrap.cObject {
key.data = levelfield:-1, backend_layout_next_level, slide
key.override.field = backend_layout
default = TEXT
default.value = fileadmin/templates/index.html
1 = TEXT
1.value = fileadmin/templates/index.html
}
variables {
# Content
content < styles.content.get
content.select.where = colPos=0
content.maxImageWidthInText.maxW = 135
.....
}
}
}
There are the registers maxImageWidth and maxImageWidthInText to do that:
content = COA
content {
10 = LOAD_REGISTER
10 {
maxImageWidth = 135
maxImageWidthInText = 100
}
20 < styles.content.get
30 = RESTORE_REGISTER
}
Couldn't find any official documentation though - you can find this stuff using the TypoScript object browser.
Related
I've got a simple template which displays the full content from "content_icon" for a "page" - so far everything fine.
Now I want to add only the image(s) from the "content_icon" - no way.
This ist the (ext+)template:
<f:section name="main">
<f:format.htmlentitiesDecode>{content_icon}</f:format.htmlentitiesDecode>
<p>-----------------------------</p>
<p>
<f:cObject typoscriptObjectPath="SliderElement.10.variables.icon"/>
</p>
<p>{icon}</p>
</f:section>
I've tried this (and many more)
https://docs.typo3.org/m/typo3/reference-typoscript/master/en-us/ContentObjects/Files/Index.html#usage-with-references but -> no output at all.
I figured out, that if I add the following assignment anything seems to be read .... I get an output - but without images ....
page_id < styles.content.get
Struggeling now for 3 days with TYPO3 10.4 extension (template).
Didn't see any light.
SliderElement = PAGE
SliderElement.10 = FLUIDTEMPLATE
SliderElement.10 {
format = html
file = fileadmin/site_elements/Templates/SliderElement.html
partialRootPath = fileadmin/site_elements/Partials/
layoutRootPath = fileadmin/site_elements/Layouts/
variables {
page_id = FILE
page_id < styles.content.get
page_id.select.where = "tt_content"."colPos" = 20
page_id {
stdWrap.wrap = <div class="pic">|</div>
references {
uid.data = uid
#fieldName = image // try
#fieldName = media // try
fieldName = assets
}
renderObj = IMAGE
renderObj {
file {
import.data = file:current:uid
treatIdAsReference = 1
}
altText.data = file:current:alternative
stdWrap.typolink.parameter.data = file:current:link
}
}
content_icon < styles.content.get
content_icon.select.where = "tt_content"."colPos" = 20
}
}
Any help or idea would be nice...
I have created one default column for the footer section for my template. And by using this typoscript.
lib.footer = COA
lib.footer {
10 = CONTENT
10 {
table = tt_content
select.orderBy = sorting
select.where = colPos=4
}
}
And tried this one too,
lib.footer = CONTENT
lib.footer {
table = tt_content
select.orderBy = sorting
select.where = colPos=4
slide = -1
}
I am able to render in the all pages except the pages which are in the Folder. So, what should be the solution in this case ?
Backendview
Outout
Try to something like this for display content.
lib.footer = RECORDS
lib.footer {
source = 1 // add content id
dontCheckPid = 1
tables = tt_content
}
For footer Menu like AGB |TEST | use below typoscript
lib.footermenu = COA
lib.footermenu{
wrap = <ul>|</ul>
20 = HMENU
20 {
special = directory
# special.value will contain the page ID of the Footer menu page
special.value = 20
1 = TMENU
1 {
target = _self
NO {
allWrap = <li>|</li>
}
}
}
}
I want to show only the first available image of different content elements in a column.
The following code shows me all available images, but I need only the first one!
Can somebody help me?
lib.contentImage = CONTENT
lib.contentImage {
wrap = |
table = tt_content
select {
languageField = sys_language_uid
where = colPos = 0
orderBy = sorting
pidInList = 32
}
renderObj = COA
renderObj{
wrap = <div class="item">|</div>
10 = FILES
10 {
references {
table = tt_content
uid.data = uid
fieldName = assets
}
renderObj = IMAGE
renderObj {
wrap = <div class="item-image">|</div>
file.import.data = file:current:originalUid
file.width = 1920c
file.height = 600c
}
}
}
}
I used this to get the url of the first image on a page for open graph tags.
page.meta.og:image.cObject = CONTENT
page.meta.og:image.cObject {
table = tt_content
select {
where = (colPos = 0 AND image != 0 )
selectFields = uid
orderBy = sorting
max = 1
}
renderObj = COA
renderObj {
1 = TEXT
1 {
cObject = FILES
cObject {
references {
table = tt_content
uid.field = uid
fieldName = image
}
maxItems = 1
renderObj = TEXT
renderObj {
typolink.parameter.data = file:current:publicUrl
typolink.forceAbsoluteUrl = 1
typolink.returnLast = url
}
}
}
}
}
page.meta.og:image.attribute = property
You would try somethings with LOAD_REGISTER
e.g.: (not tested)
lib.contentImage = COA
lib.contentImage {
5 = LOAD_REGISTER
5.imageRendered = 0
10 = CONTENT
10 {
wrap = |
table = tt_content
select {
languageField = sys_language_uid
where = colPos = 0
orderBy = sorting
pidInList = 32
}
renderObj = COA
renderObj{
wrap = <div class="item">|</div>
10 = FILES
10 {
references {
table = tt_content
uid.data = uid
fieldName = assets
}
max = 1
renderObj = COA
renderObj {
stdWrap.if.isFalse.data = register:imageRendered
5 = LOAD_REGISTER
5.imageRendered = 1
10 = IMAGE
10 {
wrap = <div class="item-image">|</div>
file.import.data = file:current:originalUid
file.width = 1920c
file.height = 600c
}
}
}
}
}
99 = RESTORE_REGISTER
}
Do you need the first one of each Contentelement or the first Image of all Contentelements?
If you only want one image for each element you can set maxItems in FILES Object https://docs.typo3.org/typo3cms/TyposcriptReference/ContentObjects/Files/Index.html#usage-with-references
I am getting Distribution.png (box with question mark) instead of wanted image while using fluid template, typo3 v6.0.
This is my root template:
config.no_cache = 1
config.doctype = html5
page = PAGE
page.typeNum = 0
page.10 = FLUIDTEMPLATE
page.10 {
format = html
file = fileadmin/templates/layouts/main.html
partialRootPath = fileadmin/templates/partials/
layoutRootPath = fileadmin/templates/layouts/
variables {
content < styles.content.get
content.select.where = colPos = 0
content_left < styles.content.get
content_left.select.where = colPos = 1
content_right < styles.content.get
content_right.select.where = colPos = 2
}
}
page.10.file.stdWrap.cObject = CASE
page.10.file.stdWrap.cObject {
key.data = levelfield:-1, backend_layout_next_level, slide
key.override.field = backend_layout
default = TEXT
default.value = fileadmin/templates/threeColumn.html
2 = TEXT
2.value = fileadmin/templates/threeColumn.html
3 = TEXT
3.value = fileadmin/templates/fullSize.html
}
In version 4.5 everyting is working ok.
Any help would be appreciated.
Iam using tt_products and trying to get a "title" param for each link to an Image, which is not provided from this extension. I have some free data-table fields left which id like to use to store the titles für each link.
This is how the Example has to look like in the Frontend after rendering each link and image.
This is the solution that i worked out till now, it loads the content from the fields but it dont split the conten of the field right and apend them to the right images
temp.imageLinkWrap = 1
temp.imageLinkWrap {
stdWrap = stdWrap
enable = 1
typolink {
parameter.cObject = IMG_RESOURCE
parameter.cObject.file.import.data = TSFE:lastImageInfo|origFile
parameter.cObject.file.maxW = {$plugin.perfectlightbox.lightBoxMaxW}
parameter.cObject.file.maxH = {$plugin.perfectlightbox.lightBoxMaxH}
parameter.override.listNum.stdWrap.data = register : IMAGE_NUM_CURRENT
title >
title.override.cObject = COA
title.override.cObject {
10 = TEXT
10{
data {
data = GP:tt_products|product
intval = 0
wrap = DB:tt_products: | :image
}
split{
token = ,
cObjNum = 1
1.current = 1
# for each image, add the imagecaption
1.wrap = |
1.append = TEXT
1.append {
data {
data = GP:tt_products|product
intval = 1
wrap = DB:tt_products: | :quality
}
# split saves the index in REGISTER:SPLIT_COUNT
listNum.stdWrap.data = REGISTER:SPLIT_COUNT
listNum.splitChar = 10
}
}
}
}
title.override.if.isTrue = 1
title.insertData = 1
parameter.cObject = IMG_RESOURCE
parameter.cObject.file.import.data = TSFE:lastImageInfo|origFile
ATagParams >
ATagParams.cObject = COA
ATagParams.cObject {
10 = TEXT
10.value = rel="lightbox[lb{field:uid}]"
}
ATagParams.insertData = 1
}
}
plugin.tt_products {
templateFile = fileadmin/template/html/partial/ext/shop-tmpl.html
pid_list = 23
wrapInBaseClass = 0
requiredInfoFields = agb, name, address, zip, city, email
limitImageSingle = 6
separateImage = 1
listImage < .image
listImage.file.maxW = 300
listImage.file.maxH =
listImage.imageLinkWrap >
image.wrap = <div class="img_single"> | </div>
usePageContentImage = 0
imageLinkWrap = 1
image {
altText = TEXT
altText.data = field:title
imageLinkWrap >
imageLinkWrap < temp.imageLinkWrap
}
}