[TYPO3] anchor tags

Christopher Torgalson bedlamhotel at gmail.com
Sat Dec 8 12:34:57 CET 2007


Hi,

Cate & Peter wrote:
>>>> lib.skip_navigation = HTML
>>>> lib.skip_navigation {
>>>> 	### The link text:
>>>> 	###
>>>> 	value = Skip to content
>>>> 	value {
>>>> 		typolink {
>>>> 			### Create a link to the current page:
>>>> 			###
>>>> 			parameter.data = field:uid
>>>>
>>>> 			### Link to a specific anchor:
>>>> 			###
>>>> 			section = content
>>>> 		}
>>>> 	}
>>>> }
> 
> Put the whole link in your template with the TS above--you can plug
>> that TS object into a marker, or subpart, or (in TV), map your links as
>> TS objects.
> 
> :S
> 
> Sorry, I haven't used typolinks before, and Im a touch confused.
> 
> lib.skip_navigation = HTML
> lib.skip_navigation {
> ### The link text:
> ###
> value = Skip to content
> value {
> 	typolink {
> 		### Create a link to the current page:
> 		###
> 		parameter.data = field:uid
> 		
> So up to here, nothing would change, right? I map lib.skip_navigation in TV,
> but don't need to add anything for any of the links.
> 
> 
> 
> ### Link to a specific anchor:
> 		###
> 		section = content
> 	}
> }
> }
> 
> And then in section=content, should I have defined that anchor in DW, or...
> should it be linked to the lib.myObject that is the content ... like
> 
> ### Link to a specific anchor:
> 		###
> section=lib.navigation
> 
> or, 
> 
> section=nav (which is the anchor I put in with DW)
> 
> or?
> 
> Thanks for taking the time to explain so far.


It's the latter--just like in the sample HTML I included with the first 
answer (i.e. where the value of the 'section' property and the name 
attribute of the anchor or the id attribute of the div matched).* The 
typolink function just makes ordinary hyperlinks.

Just to expand a bit, nothing like

	"section=lib.navigation"

...is ever going to work in Typoscript at all. In specific instances, 
code like "something < lib.navigation" will work, but it's very 
important to understand the general rules for working with TS, or a) it 
starts to become a very long process, and b) it will shorten your life ;-D

This code:

	"something < lib.navigation"

...will work IF .something is a kind of object that expects a cObject as 
its input. If not, it will fail silently and nothing will happen at all.

This IS all in the TSref, though it's tough to figure it out from that 
document alone. If you want some further reading, I self-servingly 
recommend this:

	http://www.typo3apprentice.com/howto/rtfm/

...it tries to explain how the TSref can be used effectively to solve 
problems with TS.


-- 
Christopher Torgalson / bedlamhotel at gmail.com


* If I know Dreamweaver, it will have put in the <a name="foo"></a> kind 
of anchors, but just using an id attribute instead makes for much nicer 
code. If you just put 'id="something"' into a div--you're probably doing 
this anyway for CSS purposes--you do NOT need anything like '<a 
name="something"></a>' to link to. Try it with just the ID attribute.

If you want my opinion--you didn't ask for it, so feel free to ignore it 
completely :)--Dreamweaver is a dreadful tool *unless* you're already 
quite advanced with HTML, in which case, it's a decent tool for coding.

That said however, it is, without exception, and in every version I've 
ever tried, from version 2 to the its current incarnation the very WORST 
ftp client I have ever used. I've never understood how people can use it 
to maintain static sites with large numbers of html pages and stay sane...


More information about the TYPO3-english mailing list