[Typo3] Insert of text value into Typoscript

Peter Klein peter at umloud.dk
Mon Aug 22 11:15:40 CEST 2005


"Steven Bagshaw" <steven.bagshaw at unv.org> skrev i en meddelelse 
news:mailman.1.1124453659.27971.typo3-english at lists.netfielders.de...
> Hi All,
>
> I have what seems to be a very simple thing to do, but for the life of me 
> I
> cannot find how to do it (or figure a workaround that doesn't involve
> writing PHP.
>
> I have a menu that I want to wrap a link around. The link will do some
> Javascript whizzy stuff, but for users without Javascript enabled, 
> clicking
> on the link should go to a specific URL, which is a page within my site.
> Here is my current setup
>
> 20.1 = TMENU
>    20.1 {
>      wrap = <br/><div class="showMoreLink"><a href="SOMEURL"
> onClick="javascript:showMore(2, 'Show more sectors', 'Hide extra 
> sectors');
> return false;"><img src="fileadmin/img/wvw/blaar.gif"/><span
> id="moreText2">Show more sectors</span></a></div><div id="showMoreFull2"> 
> |
> </div>
>      NO.stdWrap.field = subtitle // title
>      NO.allWrap = <div> | </div>
>      NO.beforeImg = fileadmin/img/wvw/grar.gif
>      NO.beforeImgLink = 1
>    }
>
> Now I want to replace SOMEURL with a link to a specific page ID, which 
> would
> be generated within the template code. Let's say I have used typolink to
> generate the URL - how would I then insert this value into the wrap?
>
> I have seen how one can insert constants using {$constantName} and data
> using {field:uid} etc., but I cannot find how one can similarly insert
> values from within the template itself. I must be missing something...
>

Hi Steve, you can't set constants from TS, but you can set register values 
in one TS object, and then reuse that value in other TS objects..
http://typo3.org/documentation/document-library/doc_core_tsref/LOAD_REGISTER-1/

Here's an example

temp.test = LOAD_REGISTER
temp.test.myVar.value = This is a test
temp.test.myOtherVar.field = title


temp.test2 = TEXT
temp.test2.value = {register:myVar}<br>And the title of the page 
is:{register:myOtherVar}
temp.test2.insertData = 1

-- 
Peter Klein/Umloud Untd





More information about the TYPO3-english mailing list