ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

weblog specific sidebar if

November 08, 2007 3:16pm

Subscribe [1]
  • #16 / Nov 08, 2007 6:47pm

    guerrilla

    31 posts

    Well, a few clues to the viewer are:

    a) the URL says http://drycreekcommunity.org/index.php/calendar/
    b) the page header displays the weblog name of “Dry Creek Community Calendar”
    c) the content is about upcoming community events

    or are you trying to sarcastically say that the only thing that can be compared is segment 2 which is not the weblog but the template group?

    In which case, I would have to compare segment 2 of the URL to the template group variable (and isn’t it a good thing I pass that info), yes?

    Okay, I’ve tried all kinds of ways to compare segment_2 to template group, both hard coded and as a variable, in some test code and it’s not working.

    Is there no way to figure out what actual weblog is being viewed? I kind of thought the assigned variable was there for that purpose, but apparently not.

  • #17 / Nov 08, 2007 7:02pm

    guerrilla

    31 posts

    Lisa,

    I don’t know exactly what did it, but I’m getting the right results now on the segment comparison, even in the embedded sidebar. The code now looks like this:

    {if segment_1 == "calendar"}
        <ul>
        {exp:weblog:entries show_future_entries="yes" orderby="date" sort="desc" limit="15" weblog="{embed:weblog}"  dynamic="off" disable="pagination|custom_fields|categories|member_data|trackbacks"}
        <li><a href="http://{title_permalink={embed:template_group}/index}">{title}</a></li>
    {/exp:weblog:entries}
        </ul>
    
    {if:else}
        <ul>
        {exp:weblog:entries orderby="date" sort="desc" limit="15" weblog="{embed:weblog}"  dynamic="off" disable="pagination|custom_fields|categories|member_data|trackbacks"}
        <li><a href="http://{title_permalink={embed:template_group}/index}">{title}</a></li>
    {/exp:weblog:entries}
        </ul>
    {/if}

    I still would like know if it’s possible to determine and compare which weblog I’m reading as opposed to having to use template_groups. Does this mean that every weblog has to have it’s own unique template group? No sharing of templates?

  • #18 / Nov 08, 2007 7:46pm

    Lisa Wess

    20502 posts

    Each weblog does not need its own template groups, but for what you want, you need *some way* to know, from the template or segments, *what* weblog you’re viewing. Remember, a template can show *all* of your weblogs, there is no one to one relationship here.  Since ExpressionEngine can’t read your mind, you need some way to instruct it that hey, if this is happening, then show *this* information.

    What you did works because you tested on segment_1 which happened to have calendar.

  • #19 / Nov 08, 2007 7:52pm

    guerrilla

    31 posts

    Right, because segment_1 is the template_group. My question is “How do you identify the weblog for comparison if you don’t make a custom template group for the weblog?”

  • #20 / Nov 08, 2007 8:22pm

    Lisa Wess

    20502 posts

    That would be difficult, at best. You need *some* trigger.  Some way to say “hey, computer, this page is showing the calendar!”.  In many cases that is a segment, even if it’s appended at the end of the URL, but you will need some method.  Want me to move this up to how-to for you?

  • #21 / Nov 08, 2007 8:53pm

    guerrilla

    31 posts

    No, if EE had a way of identifying which weblog was being displayed then it wouldn’t be difficult.

    You identify which template_group by reading segment_1 and which template by segment_2. And you’ve also told me that EE can’t assign variables to be used later in a conditional statement.So what you are saying is that EE can not identify which weblog, outside of the Entries Modules, for a conditional.

    In other words, if someone needs to display conditional information, they’ve got to build a (*expletive deleted*) template group for that weblog.

    See not difficult at all.

    So I don’t see where moving the thread will help.

    Thanks for clarify the limits for me.

  • #22 / Nov 08, 2007 8:57pm

    Lisa Wess

    20502 posts

    guerilla, I understand that you’re frustrated, and I do apologize.  But the limitations you speak of correct, however for incorrect reasons.  Any given template can display any data you want - it can pull in absolutely nothing from the database, if you want, or it can pull in data from all of the weblogs.  Yes, the weblog entries tag gives context, so that when it pulls up an entry, it knows what weblog that comes from (and you’ve told it from which weblogs to pull data using weblog=); but as far as the template parser knows, it could be pulling up any combination of things, and in different parts of the page.

    You have to instruct it.  It’s a machine, it can’t read the content and know your intent, you have to tell it, specifically, what your intent is.

    I suggested moving this to how to because others may have had situations like this that they resolved and would have input on; we do, after all, have a really amazing community.

    Let me know if you decide you want it moved; or you could always make a new post clearly outlining your goals and simply asking for assistance.

  • #23 / Nov 08, 2007 9:10pm

    guerrilla

    31 posts

    Move if you want, Lisa.

    It will interesting to see that either no one answers or they say what I said—EE can’t identify a weblog in a conditional statement.

    I’m on to the next wall I’ve hit.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases