1 akameswaran Sep 20, 2005 20:52
3 akameswaran Sep 20, 2005 21:14
Ok, what I am trying to do truly is make the most recent entries in one particular blog (preferably by category) allways show up first. I have one blog dedicated to news that I would like to allways be the first entries even if other blogs have had posts in the interim. I would like this to be category based, but I can adjust my use of that blog so tjat categories don't matter. While I'm a beginner at b2 and php I don't necessarily require someone to implement this for me. I'm fairly proficient with other web technologies and more useful might be highlighting for me the code the all blog uses to aggregate - It's a bit overwhelming trying to learn all the pieces of b2 while trying to learn php syntax. Due to my misunderstanding I thought it might be easier to hack it via category rather than by blog but I'm open to suggestions.
I'm reading what I just wrote and not sure if it's clear - so let me try a restatement -
Is there a way to make a particular blog "sticky" for blog all? How could I define blog all to allways post the 2 most recent blogs from say blog 3 at the top, and then present the normal blog all aggregation? A category filter on this is a plus, but on further review really not necessary. Yes I understand this is easier done via link blog - but the skin I liked (b2original) doesn't support linkblog - but more importantly linkblog doesn't fill the right amount of screen real estate for the relative importance of these entries.
4 personman Sep 20, 2005 21:24
This might get you started. There's a file called multiblogs.php that comes with b2evo. It does something similar to what you want. It displays posts from several blogs. I use the same code to make the 'Recent Media' section in my sidebar. It's just the last 4 posts from my media blog. I could make it so they look like full posts rather than sidebar item if I wanted. The multiblog code is in the skin that I'm using. This post does a good job of explaining how it works:
http://forums.b2evolution.net//viewtopic.php?p=12647#12647
5 akameswaran Sep 20, 2005 21:42
Well that does seem helpful - thanks for the response. I'll read the code, but I guess I'm also trying to understand the model used in b2.
What I don't quite get - and I'm sure there is another post on this somewhere but my searches (probably cuz I haven't learned th jargon yet) don't turn it up. But how does the main blog php know I am viewing the blog all? I can't seem to find the test for blog=<num> in the query string. I am also not clear on why I would use multiblogs.php. It appears that the blog all still uses the main.php for display. Would it not be easier to create something like this in my main.php
<!-- =================================== START OF MAIN AREA =================================== -->
if blog=1
include 2 most recent entries for blog=3
end
// remainder of main.php code
Second if I was going to use multiblogs.php where would I insert it? In the main.php? If it also goes in the main.php wouldn't it be more efficient to just write the search code for the one blog (and maybe add a category filter) than to use a more generic multiblog logic? (I'm pretty sure I am using templates- sry I'm a newb)
I could ask a million more - but I don't want to wear out your patience. If you could make some comments on the architectural issues - cool. I am more than happy to figure out the real nuts and bolts on my own.
6 personman Sep 20, 2005 21:51
<!-- =================================== START OF MAIN AREA =================================== -->
if blog=1
include 2 most recent entries for blog=3
end// remainder of main.php code
Exactly. That's what the code in multiblogs.php does. You put it right there before the post loop starts, and it will pull the last howevermanyyouwant posts from whichever blog you want. I don't know how b2evo knows which one is the blog all.
Do you want to make the Blog All display only a single category? The thing is, in b2evolution, each category belongs to a blog, so if you just display one category, then you'll just have posts from one blog, and then you're not really using it as a blog all anymore. You might be thinking that you can have a category in Blog A called 'Computers' and a category in Blog B called 'Computers', but b2evo knows each of them by their cat ID #, so it has no idea that you want the two categories to be related. I guess you could hack that idea into it, but it would be a major hack.