Still not working - but it helped a little, but what I didn’t mention is that the background image and the following text are placed to different places in the HTML – the image in a style in the header and the following text in a div inside the body…
And then I need two embedded templates - but the random aint the same then 😕
...while writing this question im thinking about using embed variables…
{exp:channel:entries channel="text_article"}
<html>
<head>
<style>
body {
padding: 0;
margin: 0;
{if background == 0}
{embed="includes/random_background" piece_name="Topper"}
{if:else}
{related_entries id="Background"}
background-image: url({photo});
{/related_entries}
{/if}
background-position: top center;
background-repeat: no-repeat;
background-color: #333;
background-attachment: fixed;
}
</style>
</head>
<body>
{title}
{if background == 0}
{embed="includes/random_background" piece_name="Hest"}
{if:else}
{related_entries id="Background"}
<div id="infoleft">
{ingredients}
</div>
<div id="inforight">
<h3>{title}</h3>
<p> {recipe_text}<br />
<br />
</div><br />
<br />
{/related_entries}<br />
{/if}</p>
<p></body><br />
</html><br />
{/exp:channel:entries}
and the embedded random_background template:
{exp:channel:entries channel="background_photo" orderby="random" limit="1"}
{if embed:piece_name == "Topper"}
background-image: url({photo});
{if:else}
<div id="infoleft">
{ingredients}
</div>
<div id="inforight">
<h3>{title}</h3>
<p> {recipe_text}<br />
<br />
</div></p>
<p>{/if}</p>
<p>{/exp:channel:entries}
But this doesn’t work - any ideas?