We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Combine search results, tag listings, category and weblog into one template

Development and Programming

ErwinVanLun's avatar
ErwinVanLun
235 posts
18 years ago
ErwinVanLun's avatar ErwinVanLun

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

       
Ingmar's avatar
Ingmar
29,245 posts
18 years ago
Ingmar's avatar Ingmar

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}
       
Brendon Carr's avatar
Brendon Carr
135 posts
18 years ago
Brendon Carr's avatar Brendon Carr

What’s this Solvay Tag module?

       
ErwinVanLun's avatar
ErwinVanLun
235 posts
18 years ago
ErwinVanLun's avatar ErwinVanLun

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 –>

include <my posting template>

{/exp:tag:entries} {if:else} {exp:weblog:entries weblog="{my_weblog}” orderby=”date” sort=”desc” limit=”15”} <!– all my fields –>

include

{/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.

       
Ingmar's avatar
Ingmar
29,245 posts
18 years ago
Ingmar's avatar Ingmar
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.)

       
ErwinVanLun's avatar
ErwinVanLun
235 posts
18 years ago
ErwinVanLun's avatar ErwinVanLun

Hi Ingmar,

Thanks again for your help but this doesn’t seem to work as the subtemplates are not allowed to carry tags.

This implies the attached result.

The tags in de subtemplate do not seem to be rendered.

So the story continues…:-s

Erwin

       
ErwinVanLun's avatar
ErwinVanLun
235 posts
18 years ago
ErwinVanLun's avatar ErwinVanLun

btw: I’m using 1.4.2 (upgrading after the summer by someone else). I understood that were recently some bugs with this behavior which makes me hopefull for a solution in my version..

       
Ingmar's avatar
Ingmar
29,245 posts
18 years ago
Ingmar's avatar Ingmar
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.

       
ErwinVanLun's avatar
ErwinVanLun
235 posts
18 years ago
ErwinVanLun's avatar ErwinVanLun

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).

       
ErwinVanLun's avatar
ErwinVanLun
235 posts
18 years ago
ErwinVanLun's avatar ErwinVanLun

So sub templates are probably not the answer for my wish.

But it isn’t a strange wish, isn’t it? Just repeat a piece of intelligent code..

       
ErwinVanLun's avatar
ErwinVanLun
235 posts
18 years ago
ErwinVanLun's avatar ErwinVanLun

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

       
Ingmar's avatar
Ingmar
29,245 posts
18 years ago
Ingmar's avatar Ingmar

I am sorry, my position hasn’t changed. I don’t why embedded templates should not work, especially with embedded variables that 1.5 (I think) brought.

       
Daniel Walton's avatar
Daniel Walton
553 posts
18 years ago
Daniel Walton's avatar Daniel Walton

or, and i can’t recall if 1.4 had this, use php on input to process the segment 2 conditionals rather than ee tag conditionals.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.