I had code like this:
{exp:channel:entrieschannel="blog_channel"limit="10"}
<h1>{entry_title}</h1>
<p>{entry_body}</p>
<p>{entry_author}</p>
{/exp:channel:entries}
Basically I want the HTML content with the exp tags to be made separate and placed in a template file. I attempted this by doing this:
{exp:channel:entries channel="blog_channel"limit="10"}
{embed="blog/post"}
{/exp:channel:entries}
My problem is the output all the tags ({entry_title}, {entry_body} etc etc) are being shown literally and the they are not being treated as a variable.
How can I fix this?
Thanks, Peter
For what it appears you're looking to do, i might suggest avoiding an embed and instead using a snippet. They're more efficient but still allow you to have the same markup used in more than one template, for example, so you don't have to repeat yourself. Some something like this:
{exp:channel:entries channel="blog_channel" limit="10"}
{sn_blog_post_list}
{/exp:channel:entries}
And then in your snippet, which in this case is called "sn_blog_post_list":
<h1>{entry_title}</h1>
<p>{entry_body}</p>
<p>{entry_author}</p>
This would allow you to use the same snippet for different instances of the entries loop. SO in a different template, you could do something like:
{exp:channel:entries channel="blog_channel" limit="30"}
{sn_blog_post_list}
{/exp:channel:entries}
And so this would again apply the exact same markup to each blog entry, but return 30 entries instead of 10 as with the earlier example without having to repeat the markup.
Hope that helps.