In my Play application, I have this configuration:
social { twitter { url="https://twitter.com" logo="images/twitter.png" } facebook { url="https://www.facebook.com" logo="images/facebook.png" } }
Ho, I iterate over all social records to get url and logo for each record?
<table border="0" cellspacing="0" cellpadding="2"><tr> @configuration.getConfig("social").map { config => @for(item <- config.entrySet) { <td><a href="item.getString("url")"> <img src="@routes.Assets.at("item.getString("logo")").absoluteURL()" width="24" height="24"/></a></td> } } </table>
Of course, item.getString in the above snippet doesn't work ... it just shows what I'm trying to achieve.
The ultimate goal would be to add any additional social url without changing the page template.
scala playframework typesafe-config
j3d
source share