Macrobyte Resources Weblog 2.0
Internet groupware development platform
Filtering a weblogview page




 

Topic: Filtering a weblogview page

Shown in forward chronological order.
Reverse chronological order | Hierarchical outline view

Messages: 10 of 10.
Pages: 1
Filtering a weblogview page (#1586)
Posted: 2/19/2006; 6:45 PM by Mike Black
Modified: 2/19/2006; 6:45 PM by Mike Black
Response to: Top of Thread.
Edit | Reply
I am creating a revised version of the site and I'm planning to split the blog in three parts personal, technology, travel.  In my present site I've already got posts categorised accordingly so I want to keep a single weblog just split it.  I think a weblog view is the most appropriate page type for what I want, however I cannot find where to define which posts appear (i.e. any filtering mechanism except by owner).  Is there a way to define a filter on what to appear in a weblog view?
Re: Filtering a weblogview page (#1587)
Posted: 2/19/2006; 7:16 PM by Seth Dillingham
Modified: 2/19/2006; 7:16 PM by Seth Dillingham
Response to: 1586
Edit | Reply

On 2/19/06, Mike Black said:

>I am creating a revised version of the site and I'm planning to split the
>blog in three parts personal, technology, travel.  In my present site I've
>already got posts categorised accordingly so I want to keep a single
>weblog just split it.  I think a weblog view is the most appropriate page
>type for what I want, however I cannot find where to define which posts
>appear (i.e. any filtering mechanism except by owner).  Is there a way to
>define a filter on what to appear in a weblog view?

Mike,

Weblogview only works with the old Weblog page type, not the Weblog II page.

Since you already have the posts categorized, I would say that you have a few options:

1. Use Weblog II channels. All you'd have to do is change your page settings to use your categories field as the Weblog Categories field. Edit your page in the "files and folders" area of admin, then click on the "Fields" link along the right side. There you'll find a form for changing your 'Category / Channel Field' to the one you've already used. This approach gives you one 'weblog' per category, with paths like index/channel/myCategory (Each channel even has its own RSS feed.) 2. Use an Advanced Query Page, formatted to display the last N items which have a certain category. Your 'item' templates are really just message templates (or weblog item templates), so you can actually reproduce the look of a weblog. 3. Start with the first option, above, but display your 'channels' somewhere else on your site, using different templates! You do this with the weblog.wrapper or weblog.days macros (either will work, it just depends on what you want). One quick way to set this up: put the macro in a message, publish the message (that is, "bind it" or "create a bound URL page with that message") to whatever path you want, and use the new page's Bound URL template to control the page's framing. Note that the weblog.wrapper and weblog.days macros both support the attributes channel, dayTemplate and itemTemplate, so you really can reproduce your weblog anywhere on your site with the same content but completely different templates.

I hope that was clear. It's great that you're working on this!

Seth

Re: Filtering a weblogview page (#1588)
Posted: 2/19/2006; 8:28 PM by Mike Black
Modified: 2/19/2006; 8:28 PM by Mike Black
Response to: 1587
Edit | Reply
Seth,

Thanks for the fast reply.  Actually I've mocked up what I want to do using the Advance Query Page and it worked. However I'll try to do it the channels way cause it's more elegant. 

Mike
Re: Filtering a weblogview page (#1589)
Posted: 2/20/2006; 8:01 PM by Mike Black
Modified: 2/20/2006; 8:01 PM by Mike Black
Response to: 1587
Edit | Reply
Seth,

You rock!!! I managed to implement solutions 1 and 3 to get exactly what I wanted. Now I've got different channels of the blog displayed using different templates and stylesheets. 

There is another thing that I need to solve.  Although the weblogs are being displayed correctly when you post a new message or else view a single message in the 'channel weblog' the main page template is used.  What would be perfect is a way to change the message view and message edit templates according to the appropriate context.  If you managed to understand my not so good explanation, do you think it's possible?

Mike
RE: Filtering a weblogview page (#1590)
Posted: 2/20/2006; 8:29 PM by Seth Dillingham
Modified: 2/20/2006; 8:29 PM by Seth Dillingham
Response to: 1589
Edit | Reply
On 2/20/06, Mike Black said:

>You rock!!!

Mabye sometimes. Certainly seems so anyway, doesn't it? ;-)

>I managed to implement solutions 1 and 3 to get exactly what I wanted. Now >I've got different channels of the blog displayed using different >templates and stylesheets. 

Very cool. Terry and Clark will be happy about this, too, when they realize that part of why you're doing this is to prepare for the patterns contest. :-)

(They are co-sponsors of the contest.)

>There is another thing that I need to solve.  Although the weblogs are >being displayed correctly when you post a new message or else view a >single message in the 'channel weblog' the main page template is used.  >What would be perfect is a way to change the message view and message edit >templates according to the appropriate context.  If you managed to >understand my not so good explanation, do you think it's possible?

I think you're asking for a way to set the Message View and Message Edit templates for a message, based on the channel in which the message appears on your weblog.

You *can* do that, but before I explain it could you confirm that's what you want?

Seth

RE: Filtering a weblogview page (#1591)
Posted: 2/21/2006; 3:13 AM by Mike Black
Modified: 2/21/2006; 3:13 AM by Mike Black
Response to: 1590
Edit | Reply
> I think you're asking for a way to set the Message View and Message Edit templates for a message, based on the channel in which the message appears on your weblog.

Yes, that's exactly what I want
RE: Filtering a weblogview page (#1592)
Posted: 2/21/2006; 11:32 AM by Seth Dillingham
Modified: 2/21/2006; 12:01 PM by Seth Dillingham
Response to: 1591
Edit | Reply

On 2/21/06, Mike Black said:


>>I think you're asking for a way to set the Message View and Message Edit
>>templates for a message, based on the channel in which the message
>>appears on your weblog.
>
>Yes, that's exactly what I want

There's no 'official' way to do it. What I mean is that you won't find some form in the admin area for controlling this bit of logic. However, you can do it with Conversant's macros.

I'm going to just describe the solution for your message view template. The same approach can be used for a message edit template.

Your weblog channels are formed from the items in a custom field. By default, it's the WeblogCategories field. Those items all have two properties (more, actually, but we only care about two of them): a display string (name) and a numerical value. You create the name either when you add an item to the field, or when you add a channel to your weblog (which does the same thing) and can edit it at any time, but the numerical value is assigned automatically by Conversant and can't be changed.

Now, to make your message templates work the way you want, you have two choices:

1. just use a conditional macro to test the value of that field and insert a different message template

<!--#if condition="msg.customField.weblogCategories.name contains 'travel'"-->
    <!--#insertTemplate name="message view (travel)"-->
<!--#elseif condition="msg.customField.weblogCategories.name contains 'work'"-->
    <!--#insertTemplate name="message view (work)"-->
<!--#endif-->

2. set up your different message templates in a way that lets you insert the appropriate template in a single step, like this:

<!--#insertTemplate
    name="message view (<!--#msgCustomFieldProperty 
        fieldName="weblogCategories"
        propName="name"-->)"-->

When using the second approach, keep in mind that the #msgCustomFieldProperty macro will only look at the first value you've selected in the field (so if you used a field that displays as checkboxes or a "multi select" field, and chose more than one value, you may not get the results you expected).

Whichever method you use, you'll have a single 'master' message view template which actually does nothing except contain the logic for inserting the appropriate template based on the values you've chosen. Keep in mind that you'll need to watch out for cases where no value is set at all.

This is actually pretty simple, so I hope I haven't confused you. The first approach is more flexible and easier to read, but the second approach seems a little more elegant and may require less 'management' in the long run.

I hope this all made sense.

Seth

Re: Filtering a weblogview page (#1594)
Posted: 2/24/2006; 5:46 AM by Mike Black
Modified: 2/24/2006; 9:23 AM by Seth Dillingham
Response to: 1587
Edit | Reply
Hi,

I'm implementing the weblogs.days macro in a binded message to show a message with a different template in the main site (as described in http://weblog2.macrobyte.net/1587), and am running into a hell of a problem. I managed to implement it successfully on the test site but all of a sudden without ever changing anything it broke (even on the test site). The code I'm using in the message is this:-

<!--#weblog.days dayTemplate="KiwiWeblogDay" channel="ecuador"-->

But it is returning

<!--weblog.days: Can't find a sub-table named 'weblogData'.-->

Do you know why this may be happening? Also is there any documentation on the weblog.days and weblog.wrapper macros?

Thanks,

Mike

Re: Filtering a weblogview page (#1595)
Posted: 2/24/2006; 2:01 PM by Seth Dillingham
Modified: 2/24/2006; 2:04 PM by Seth Dillingham
Response to: 1594
Edit | Reply

On 2/24/06, Mike Black said:

>I'm implementing the weblogs.days macro in a binded message to show a
>message with a different template in the main site, and am running into a
>hell of a problem. I managed to implement it successfully on the test site
>but all of a sudden without ever changing anything it broke (even on the
>test site). The code I'm using in the message is this:-

You *must* have changed something, because there haven't been any updates to the code in the last couple of days.

><!--#weblog.days dayTemplate="KiwiWeblogDay" channel="ecuador"-->
>
>But it is returning
>
><!--weblog.days: Can't find a sub-table named 'weblogData'.-->

Where is this macro being used? (What page?)

>Do you know why this may be happening? Also is there any documentation on
>the weblog.days and weblog.wrapper macros?

My guess is that it's happening because you didn't tell it where to find your Weblog II page.

Yes, there is documentation for the the weblog.days macro, now. I've added it to the outline of macro docs.

Here's a copy of the docs for this macro (it's long!) for your quick reference.

weblog.days

  • Description:

    Renders the 'days' which will appear on the request page of the weblog. (Remember that content on the weblog is grouped by day.)

    This macro is typically found in the 'weblog wrapper' template, but that is not required: you can use the weblog.days macro anywhere. You can even use it on a non-weblog page if you specify which weblog it should use.

    The standard behavior for this macro is to return the number of days specified in the weblog's page properties (in Conversant's admin area). The page properties also (normally) determine the day and item templates used. However, you can override all of these things with the parameters/attributes provided with the weblog.pageWrapper macro, which can further be overridden here in this macro.

    This macro uses 'scope' to figure out the values for any parameters/attributes you don't provide. That is, if you don't specify the value for something as a macro attribute, it checks the values for the weblog.pageWrapper macro if one was used. If the value can't be found there, then it uses the weblog's own page properties. (In the normal case, which is just a request for an actual Weblog II page, everything is just specified by the page settings and you don't even need the flexibility provided by this macro and its many attributes.)

    Important: This macro can only run if it knows which Weblog II page you're trying to present. If the macro is used on a Weblog II page, then it will used that page by default. However, if this macro is being used on a non-weblog page, then one of the following must be true:

    • The macro is part of a "weblog wrapper" template (inserted via the weblog.pageWrapper macro), and the weblog.macro wrapper includes the pageId (or path) attribute to specify which page you want to render.
    • This macro includes the pageId (or path) attribute to specify which Weblog II page is being rendered (see the first two attributes in the list, below).
  • Parameters/Attributes:
    • pageId

      Required (unless a weblog page is already in scope). If your site (conversation) has more than one wblog, and a weblog is not already "in scope" (being rendered), use this attribute to specify which weblog should be checked to see if it uses the message.

      Format: pageId="conversationName/path/to/weblog/page"

      Example from the weblog 2 beta site: pageId="weblog2beta/index". Here, weblog2beta is the name of the conversation, and the Weblog II page is named "index" and can be found right at the 'root level' of the site (it's not in a subfolder).

    • path

      Deprecated.

      This is an alternative to the pageId parameter, and is only included for backwards compatibility. Same format as pageId, but without the name of the conversation or the first slash (so, "index" instead of "weblog2beta/index").

    • channel

      Optional.

      If included, then only the specified channel will be rendered. Use the channel's "short name" (the URL-friendly name), not the display name.

      If omitted, then whatever channel is already 'in scope' will be used instead.

    • format

      Optional. Specify the type of output format being requested.

      Current choices are HTML and RSS. If it's not specified anywhere, then HTML is assumed.

    • daysToDisplay

      Optional.

      How many days should be included in the output from this macro?

      Only affects requests which are not for the weblog's archives (no date was specified).

    • archiveDaysToDisplay

      Optional.

      If archives are being requested (meaning, the request includes a date), how many days should be shown?

    • dayTemplate

      Optional.

      Specify the name of the weblog day template to use for rendering the days.

      Very useful when you want to show different parts of your weblog in different ways. For example, by combining the dayTemplate and the itemTemplate parameters, you could use minimal templates to insert "recent headlines" from your weblog anywhere on your site.

    • daySeparatorText

      Optional.

      Specify the text or HTML that is placed between days in the output.

    • itemTemplate

      Optional.

      The name of the template used to display the items on each day in the output from this macro.

    • itemSeparatorText

      Optional.

      The text or HTML placed between each item in the output.

    • startingDay

      Optional.

      How many days back (into the archives) from the original request should this macro start? In other words, if the request was for 2005/12/31, and this value is 5, then it should start 5 days back in the archives so the output would start with 2005/12/26.

      This parameter is currently broken, don't use it. It always goes back the specified number of days, even if there are no items on those days.

    • allowCache

      Optional. Boolean value: set to "true" or "false".

      This is the master 'caching' switch. Default value is 'true', but it won't even be checked if the weblog.pageWrapper or the page's properties (in the admin area) have disabled caching.

      The rest of the caching attributes (see below) are ignored if this value is 'false'.

      What is caching? The server will keep a local copy of the 'rendered output' for each day, so that additional requests for those days don't have to be re-rendered. In the cacched copy, all of the macros and resources are already processed, so the server doesn't have to do much of anything.

    • allowGuestCache

      Optional. Boolean value: set to "true" or "false".

      Default is true, unless caching is disabled entirely by allowCache.

      When the page is rendered for a guest (anyone who hasn't logged in, including crawlers), should the output be cached so that more requests for the same days (by more guests) do not need to be re-rendered? HUGE performance boost.

    • allowMemberCache

      Optional. Boolean value: set to "true" or "false".

      Default is true, unless caching is disabled entirely by allowCache.

      When the page is rendered for a member (anyone who is logged in, but is NOT an admin), should the output be cached so that more requests for the same days (by members) do not need to be re-rendered? This is great for performance, but make sure you don't have any member-specific or group-specific macros in your templates (all members will see the same cached pages).

    • allowAdminCache

      Optional. Boolean value: set to "true" or "false".

      Default is true, unless caching is disabled entirely by allowCache.

      When the page is rendered for an admin, should the output be cached so that more requests for the same days (by another or the same admins) do not need to be re-rendered?

      It's useful to set this attribute to "false" when you're working on your templates or debugging a problem, so that you can be sure to always see a fresh copy.

    • cacheMinutes

      Optional.

      If caching is enabled, for how many minutes should each day be cached (on the server) from when it is first rendered?

Re: Filtering a weblogview page (#1596)
Posted: 2/24/2006; 4:40 PM by Mike Black
Modified: 2/24/2006; 4:40 PM by Mike Black
Response to: 1595
Edit | Reply
Thanks Seth,

Issue solved. Actually what I had missing was the pageId. When I said it was working it was because the context were I was using is defaulted correctly but once I moved it away from the main folder it stoped.  The solution was:-

<!--#weblog.days pageId="mindspill/index" dayTemplate="KiwiWeblogDay" daysToDisplay="20" channel="ecuador"-->

Mike
Messages: 10.
Pages: 1


 
© 2002 Macrobyte Resources. All rights reserved.