typo3 - Is it possible to write a specific query in typoscript -
My question may look insignificant, sorry if it is! I'm currently learning typo3 and typoscript. I want to create a template with a dynamic background image. This image is stored in a directory. I would like to get the image name from the table tt_content However, the way it works makes me a little confused And I do not know that it's okay to take mine.
The code looks like this:
20 = content 20.table = tt_content 20.select {where = pid = 79} 20. header image path = COA 20. header imagepath {10 = Text 10.stdWrap.field = image 10.stdWrap.wrap = & lt; Div class = "background-media" style = "background-image: url ('|'); background-repeat: repeat any; background-shape: cover; background-attachment: fixed; background-position: 50%;" Data-start = "background-position: 50% 50%" data -70-up-down = "background-condition: 50% 70%" & gt; & Lt; / Div & gt; } I would like to store information about the image in a variable (Divya part in code) and put it in my template. The template section of my code looks like this:
& lt; F: format.raw & gt; {Headimage} & lt; / F: format.raw & gt; or
& lt; F: cObject typoscriptObjectPath = "headerimage" /> So my question is, am I choosing things from the database and am storing a variable right and the way I am telling them right in the template? Should work upwards but I have some minor errors, is it a good practice or should I work differently?
Kind regards
etc
Your snippet work Because your structure is very wrong.
ON
20.Addressor imagepath = COA You try to make someone new on one.
20 = CONTENT This will not work.
But in the content object there is a property called render oz.
See the following example:
Uninstalled
Try it like this:
lib.headerImagePath = CONTENT lib. HeaderImagePath {# First you need the table, call content = tt_content {# Add your callpost # In this example, I store my header image in colombo 9 where = colPos = 9 # PID from the current field or your own Own # pidInList = 123 pidInList.field = uid languageField = sys_language_uid} Render Obje = COA render oz {# FILES objects in TYPO3 6.x 10 = file pelted in 10 {# Set a reference to let the file go to the object, where we get the image reference {table = tt_content uid.field = uid fieldName = image} # Make sure we can only get the maximum image in the set Max_tems = 1 renderObj = COA renderObj {# We need the URL only, not the whole image, so we do not need an IMG_RESOURCE and an IMAGE object 10 = IMGSsers 10 {stdWrap {wrap = & lt; Div class = "background-media" style = "background-image: url ('|'); background-repeat: no-repeater; background-shaped: cover; background-attachment: fixed; background-position: 50%;" Data-start = "background-position: 50% 50%" data -70-up-down = "background-condition: 50% 70%" & gt; & Lt; / Div & gt; Required = 1} # Import the file from the current object # and treat the ID as a reference (TIPO3 File Abstraction Layer) file {import.data = file: current: uid treatIdAsReference = 1}}}}}}} See also this example:
Get header images from Media Elements directly in those page properties:
Comments
Post a Comment