Create dynamic css from media field data


/ Published in: TYPO3
Save to your folder(s)



Copy this code and paste it in your HTML
  1. css = PAGE
  2. css {
  3. typeNum = 22
  4. config {
  5. additionalHeaders = Content-type: text/css
  6. disableAllHeaderCode = 1
  7. }
  8. stdWrap.required = 1
  9. stdWrap.wrap = |
  10. 10 = TEXT
  11. 10.value (
  12. .content_header_pic {
  13. )
  14. 20 = TEXT
  15. 20.data = levelmedia: -1
  16. 20.listNum = 0
  17. 20.wrap = background: url('uploads/media/|');
  18. 30 = TEXT
  19. 30.value (
  20. border-top: 8px solid #0D337A;
  21. height: 105px;
  22. width: 100%;
  23. }
  24. )
  25. 30.if {
  26. isTrue.data = levelmedia: -1
  27. }
  28. }
  29.  
  30.  
  31.  
  32.  
  33. [...]
  34.  
  35.  
  36.  
  37. page = PAGE
  38.  
  39. page {
  40. headerData {
  41. 16 = TEXT
  42. 16.dataWrap = <link rel="stylesheet" type="text/css" href="index.php?id={field:uid}&type=22" />|
  43. }
  44. }

URL: http://typo3.schloebe.de/typoscript/dynamische-css-erzeugen-aus-mediafeld-daten/

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.