Hi,
Standard, EE is delivered with -an index template that handles multiple entry template: archive, categories, and standard. -a posting template to handle single entries. -a search template for seach results
Now, I have purchased the Solvay Tag module. Instead of adding another templates, copying all the code, I would like to reduce to only two templates: 1. ‘Index’ for multiple entry page. Containing: standard, categories, tags and search 2. Posting for single entry page. Containing single posts, extended text, comments and comment form.
This is my (reduced) code with ‘tag’ as example:
{if segment_2 == "tag"}
{exp:tag:entries weblog="{my_weblog}" orderby="date" sort="asc" limit="15" }
{if:else}
{exp:weblog:entries weblog="{my_weblog}" orderby="date" sort="desc" limit="15"}
{/if}
<!-- all my fields -->
{title}
{summary}
{body}
{if segment_2 == "tag"}
{/exp:tag:entries}
{if:else}
{/exp:weblog:entries}
{/if}
This leaves me o a page saying: {/exp:weblog:entries} And no more than that.
I think the sequence of parsing/rendering does confuse the system but i’m not sure. Does anyone have suggestions?
Regards
Erwin
You can’t separate opening and closing tags like that. Try this:
{if segment_2 == "tag"}
{exp:tag:entries weblog="{my_weblog}" orderby="date" sort="asc" limit="15"}
<!-- all my fields -->
{title}
{summary}
{body}
{/exp:tag:entries}
{if:else}
{exp:weblog:entries weblog="{my_weblog}" orderby="date" sort="desc" limit="15"}
<!-- all my fields -->
{title}
{summary}
{body}
{/exp:weblog:entries}
{/if}
o :-( That’s a shame. Although {title}{summary}{body} look a small piece of code above, in practice it’s much longer.
I would like to avoid double code for maintenance reasons.
Is it an idea to make a separate template for the {title}{summary}{body} tags and to include it here. It would then look like this:
{if segment_2 == "tag"} {exp:tag:entries weblog="{my_weblog}” orderby=”date” sort=”asc” limit=”15”} <!– all my fields –>
{/exp:tag:entries} {if:else} {exp:weblog:entries weblog="{my_weblog}” orderby=”date” sort=”desc” limit=”15”} <!– all my fields –>
{/exp:weblog:entries} {/if}
The question is: what would be the syntax of the #include line?
@Brendon: The Solvay Tag Module is a separate Module you can buy (about $30 dollars I remember). It’s very handy to tag your postings and to generate a tag cloud automatically.
I would like to avoid double code for maintenance reasons.
Use a sub template, then, why don’t you?
The question is: what would be the syntax of the #include line?
{embed=termplate_group/template}
The Solvay Tag Module is a separate Module you can buy (about $30 dollars I remember).
Actually, the company’s name is “Solspace” (Disclaimer: I do some support work for them.)
Thanks again for your help but this doesn’t seem to work as the subtemplates are not allowed to carry tags.
Of course they are. What you can’t do, however, is do something like
{exp:weblog:entries}
{embed=includes/template}
{/exp:weblog:entries}
… and have tags in “template” that rely on an opend {exp:weblog:entries}. As I’ve said, you can’t separate tags like that.
Oh yes, and you definitely should upgrade to 1.6. A few things changed, among them how variables are handled for embedds.
Tx again.
But this would imply that there is no solution for my wish. I always have to enter the tags:
<!-- all my fields -->
{title}
{summary}
{body}
{/exp:tag:entries}
(which are in reality 2 A4 pages) 3 times: for tags, for search of for standard listings (incl archive and categories).
Hi Ingmar,
Just to explain further. I am actually looking for the solution of the following problem:
If View = Standard/Achive/Category 40 lines of code elseif View = Search 40 same lines of code elseif View = Tag 40 same lines of code endif
This explanation might further illustrate the issue im dealing with
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.