[TYPO3] RandomImage-Call with TypoScript
Ryan Off
ryan at ryanoff.com
Thu Jul 20 23:46:56 CEST 2006
A previous message I still have around from Scott shows how to use
Typoscript to show a random content item from another area (which
sounds to be similar to what you are trying to do). Here is his
Typoscript... Thanks Scott..
// subparts.FEATURE is a label for the spot in the
// HTML where I want the elements to appear
// COA_INT is a non-chached version of the COA element
// (refer to the TS ref for more info)
subparts.FEATURE = COA_INT
subparts.FEATURE {
// use the CONTENT type when generating content
// (as opposed to just statically inserting it
here)
10 = CONTENT
10 {
// for an explanation of what's going on here,
// check this link:
//
http://typo3.org/documentation/document-library/references/
doc_core_tsref/current/view/8/9/
table = tt_content
// use a little bit of SQL ...
select {
// The PID of the page which stores the
// content (in my case, 1092)
pidInList = 1092
// only display 1 element at a time
max = 1
// this is the part that makes the magic!
// Random generation!
orderBy = rand()
}
}
}
Ryan Off
+31 (0)628 434 880
ryan at ryanoff.com
www.ryanoff.com
On 20 Jul 2006, at 13:41, Tobias Graf wrote:
> Hello everybody
>
> I use Typo3 4.0 with TemplaVoila and mapped a div-tag to lib.image.
> Now,
> I installed the extension wag_randomimage which is working fine, if I
> add a new content element to a page and select Insert Plugin > Random
> Image ...
>
> But I would like to call generate this random image in the
> setupfield of
> my template, where I wrote the following code:
>
> ************************************
> includeLibs.tx_wagrandomimage =
> EXT:wag_randomimage/pi1/class.tx_wagrandomimage_pi1.php
>
> lib.image = USER_INT
> lib.image.userFunc = tx_wagrandomimage_pi1->main
> ************************************
>
> This code generates the following output (in the frontend):
>
> ************************************
> <!--
> BEGIN: Content of extension "wag_randomimage", plugin
> "tx_wagrandomimage_pi1"
> -->
>
> <div class="tx-wagrandomimage-pi1">
>
> </div>
>
> <!--
> END: Content of extension "wag_randomimage", plugin
> "tx_wagrandomimage_pi1"
> -->
> ************************************
>
> The image (<img src="path/to/image"> is supposed to show up inside the
> div-tag. But it is missing (if I call the plugin with TypoScript).
>
> Could someone tell me either, what is wrong with my configuration
> (setup-field or elsewhere)
>
> OR(!)
>
> how, I can call a content element from the setup-field. Something like
>
> ************************************
> lib.image = ELEMENT
> lib.image.id = 88
>
> ************************************
> _______________________________________________
> TYPO3-english mailing list
> TYPO3-english at lists.netfielders.de
> http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-english
More information about the TYPO3-english
mailing list