How to build a blog


(Andrew Harris) #1

I understand it's possible to create a simple 'blog-like' environment using Matrix.


I'm vaguely aware it's going to involve a mixture of asset listings, asset builders, news items, paint layouts, comments, permissions and feeds.



I'm also certain that I'm going to make lots of mistakes and waste lots of time, so rather than stumbling through in my usual trial and error fashion I'm going to call on the #lazyweb up front…



Would anyone mind sharing a simple set of steps that I might follow to reduce my error rate? pleeez! :slight_smile:


(Nic Hubbard) #2

You are correct about what types of assets to use.


First, I would create an asset listing which would list your news items. Then, apply a paint layout to that asset listing, which would paint the news items under that parent.



In the paint layout type format you would add your keywords to print the news body, and also nest an asset builder there, with dynamic parameters set to the current asset.



That is pretty much it, but not too detailed. :slight_smile:



If you wanted to get even more complicated, you could nest another asset listing in the type format of the first, and use list_current_asset_id to show how many comments each posting has. Just an idea.



Good luck.


(Andrew Harris) #3

Thanks Nic, gives me confidence that I'm going forward in the [vaguely] correct direction!


(Andrew Harris) #4

oops, spoke too soon! I've run up against some problems - hoping for a few more gentle pointers.


First, I'll try to simply map out my site so far:

    + blog (1)
      + Post builder (2)
      + Comment builder (3)
      + Comment listing (4)
      + a post (5)
    + a comment (6)
    
    + blog paint layout (7)
      + Page Contents (8)
      + Type Formats (9)
    + Default Format (10)
    + News Item Format (11)


The blog (1) is an asset listing which lists my news items (posts). (2) is my asset builder which creates posts as children of (1). This much is working just fine.

The first problem is with my paint layout. I want to nest (3) and (4) in the paint layout so that they display after the blog post. When I try to create new divs in the News Item Format (11) I just get a blank space. I can see the new div in the asset tree, but I have no access to it in the working pane. This doesn't seem right. I can create the nested divs in the Page Contents (8), but then I get a comment form and asset listing on assets which aren't news items eg:(1). Do I have to go back and make a plain paint layout to override for the non-news item assets? - messy! Am I right in thinking I should be able to nest content in the News Item Format (11) layout?

The second problem is these dynamic parameters - I've never understood this stuff! My blog post correctly shows the comment list (4) and comment form (3) below the post content, but how do I get the comment asset listing to dynamically use the current blog post as the root node? and following on from that, how do I get the comment form to use the current blog post as the create location?

Finally - is it all worth it? (no, you don't have to answer that! ;-)

(Nic Hubbard) #5

[quote]
oops, spoke too soon! I've run up against some problems - hoping for a few more gentle pointers.

[/quote]



After you created a new nested divs, have you tried releasing locks and acquiring them again? I have seen this issue before, where you create a div and you re not allowed to edit it until you release the locks and get them again. Not sure why that happens.



For the comment listing to use the current blog, you need to set the root node to your entire site, and Dynamic Parameters to "Replacement Root node for the listing" and Source to "Current Asset". For the asset builder, go to the create locations screen. At the bottom you will see Additional Create Locations. Set the parameter to "Additional Create Locations" and Source to "Current Asset". Also, set the permitted tree location (probably your main blog asset listing) and the allowed asset types, meaning the asset type comments are allowed to be created under. In your case, this would be news items.



Let us know if this helps.


(Andrew Harris) #6

Nic, thanks so much - you were right about the release/acquire locks thing - who knows what's going on there.

Finally, joy! It does work - thanks very much for your most excellent help. I had a few hiccups with the dynamic create location - didn't seem to work the first time - there was an extra option of Asset ID/keyword once I'd selected the 'Current Asset' it started working once I'd toggled this from one to the other and back again. Again, who knows why!

Anyhow, it's butt ugly at the moment, so now I've gotta get busy with my my html and CSS and make it pretty :-), Cheers!

(Anton Babushkin) #7

You may also want to use a Trigger to clear the cache for the asset listing(s) + the news item when a new comment is created. This will ensure that new comments are always visible =)


(Catherine Knight) #8

Hi,
I hope you don't mind me adding my issues to yours. I'm a bit stuck on the asset builder part. I have nested the asset builder for comments in the news item paint layout.

My asset list of news items has more than one news item on the page. The comments are successfully nested under the appropriate news item.



When you fill in the asset builder form, it links teh new comment to the frist news item - irrespective of which news item you wanted to comment on - and then submits all the other forms on the page too, resulting in errors.

What am I missing?

Thanks.


(Pw) #9

[quote]
Hi,

I hope you don't mind me adding my issues to yours. I'm a bit stuck on the asset builder part. I have nested the asset builder for comments in the news item paint layout.

My asset list of news items has more than one news item on the page. The comments are successfully nested under the appropriate news item.



When you fill in the asset builder form, it links teh new comment to the frist news item - irrespective of which news item you wanted to comment on - and then submits all the other forms on the page too, resulting in errors.

What am I missing?

Thanks.

[/quote]



I think there is something wrong on "Create Locations" screen of Your Asset Builder. What You have selected on that screen?



"Submit button" after successful action on default takes You to the Asset Builder URL to "Created" Page. I'm avoiding this by using jQuery with AJAX. Maybe You can avoid this by trigger or even simplier - just customise "Created" Page of Your Asset Builder.


(Webmaster) #10

I'm working on this too, and have used this forum post to build most of (thanks for the tips in it!). But I do have some issues. Can anyone help?

  1. When I add a new comment to the blog, I can't get it to display the blog page, with my comment. If I manually return to the blog page via hyperlinks the comment shows up so I don't think it's caching. If I modify the 'created' page of the new comment builder I can get it to show the name of the new comment with %asset_name%, but not the body of it. Is there an asset keyword for that that I can use there? Currently I have it set so that the user is returned to the "blog listing" asset listing launch page and has to reselect the blog they were viewing to see their comment. I've used this via a Trigger with 'redirect to URL', but can't find a way to let that setting choose the blog page. I can manually specify the URL for the blogs listing, or I can use a keyword there to specify the comment as an asset itself, but I can't seem to say "redirect to one page back from this comment asset". So using the Created page I don't have keywords for body (and would like date/time as well), but using the redirect to URL trigger I don't have a keyword for "this asset's parent", either. Is there some way I can have a viewer who has submitted a comment be immediately taken to the blog (news item) page that comment belongs to, rather than the asset listing page of blogs or the page for the comment itself?


  2. Would there be a way to have, on the asset listing launch page of blogs, an indication of how many comments are on each blog? Is there some sort of keyword for "how many children of this asset" that I can throw into the type format?



    TIA,

    Deb

(Nic Hubbard) #11

[quote]
Is there some way I can have a viewer who has submitted a comment be immediately taken to the blog (news item) page that comment belongs to, rather than the asset listing page of blogs or the page for the comment itself?

[/quote]



Are you nesting the asset builder into the blog page, using a paint layout? What I have done always, is just use javascript to grab the submitted title and comment, then just append that to the DOM so that it looks like it is instantly added. Check out the commenting system on the Matrix Community site: http://community.squiz.ne


[quote]

Is there some sort of keyword for "how many children of this asset" that I can throw into the type format?

[/quote]



For this, you need to create a "child count" asset listing. Configure a normal asset listing with the type of child assets you want to count, in this case it is probably comment assets. Then, in the Page Contents of that asset listing, add the %asset_count% keyword. Then in the Dynamic Parameters section of the asset listing, change the Parameter to replacement root node. Then set the Source to Session variable name. Hit commit, then go back down to that section and add list_current_asset_id for the session var name. Now, go back to your main blog asset listing, the one that you want to show the child comment count. Go to the type format for that asset listing, and nest your "child count" in that type format. Doing that will count the children and display how many comments are under each blog posting.



I know this is a complicated setup, but it is very powerful. Search for list_current_asset_id in the forums for more talk of that feature.


(Webmaster) #12

Thanks Nic. That's awesome. The comment numbers works fine when I also edited the default format of that asset listing to be blank so that it didn't show the name of each comment in a list. That's pretty spectacular, thanks! :slight_smile:


I will have a read of the suggested Community site, but I'm wondering if not knowing any javascript would hinder me. Yes, I am nesting the asset builder into the blog page with a paint layout. I'll check out Community and see if that helps. Frankly, that one's the "nice to have" thing, and its current action of returning the commentor to the main asset listing page for the blog list is acceptable, if not ideal.



Thanks for your help. :slight_smile:


(Nic Hubbard) #13

[quote]
The comment numbers works fine when I also edited the default format of that asset listing to be blank so that it didn't show the name of each comment in a list.

[/quote]



Whoops, forgot to mention that part. Glad you figured it out. :slight_smile:


(Charlotte Westney) #14

Hello fellow blog builders!


I've got a comment facility all set and working fine - in fact working too well, and it has attracted the spam bots. So I've tried to add in a captcha field in the Create form layout part of my asset builder. I can get the captcha to show up, but I'm still able to fill in a comment without filling in the captcha.



So how can I get the captcha to work?

Have any of you got captchas on your blog comments working?



Thanks!

Charlie.


(Nic Hubbard) #15

[quote]
Have any of you got captchas on your blog comments working?

[/quote]



Yes I have many many times. Have you made sure to set "Require Captcha" to Yes?


(Charlotte Westney) #16

Ahhhh yes - now you mention it, its obvious! Right there on the main asset builder screen. Doh!
Thanks Nic ;o)


(Nic Hubbard) #17

[quote]
Ahhhh yes - now you mention it, its obvious! Right there on the main asset builder screen. Doh!

Thanks Nic ;o)

[/quote]



Yeah, I think it is a small bug that those captcha keywords show in the drop down when Require Captcha is not set to Yes.


(Andrew Harris) #18

We have no success with CAPTCHA at all. I believe it's something to do with caching in our environment, but unless we address a form with _nocache we get a blank CAPTCHA image and submissions don't work. Nesting the form just seems to further complicate the caching problem. I've given up for now.


(Nic Hubbard) #19

[quote]
Nesting the form just seems to further complicate the caching problem. I've given up for now.

[/quote]



I don't think that nesting forms is meant to work.


(Peter Bridgfoot) #20

Is it possible to have a setup where a user can reply to a comment on a comment?