BASE TAG

On 15 febbraio 2012, in Senza categoria, by admin

Capita a volte che si sia costretti a specificare in pagine web il tag <base>, spesso succede se si utilizzano dei campi HTML Editor Field in cui il cliente carica delle immagini che poi però non vengono trovate dal front per l’url “malformata”.

Per risolvere questa issue basta mettere nel tag <head> del template della Page.ss generica (quella con header e footer) questa dicitura:

<% base_tag %>

Che riassume tutti i basetag utili in modalità silverstripe compatibile.

 

Per dare a ogni pagina la possibilità che il tag <body> abbia come classi css i riferimenti a pagina corrente e padri e figli bisogna utilizzare questo codice:

<body id="inside" class="<% if Level(1) %><% control Level(1) %> $URLSegment <% end_control %><% end_if %><% if Level(2) %><% control Level(2) %> $URLSegment <% end_control %><% end_if %><% if Level(3) %><% control Level(3) %> $URLSegment <% end_control %><% end_if %><% if Level(4) %><% control Level(4) %> $URLSegment <% end_control %><% end_if %><% if Level(5) %><% control Level(5) %> $URLSegment <% end_control %><% end_if %>">