1 stk Feb 01, 2005 16:07
3 stk Feb 01, 2005 18:18
Graham ... thanks for the quick response. I swear, I looked in the stub file, but my eyes must have been blurry from lack of sleep. That's exactly where I figured a modification should go.
PS - I'm using your 'london' skin on our new journal. THANKS for your contribution! I've been modifying it some. If you want to see a London offspring, [url=http://randsco.com]have a peek[/url].
4 stk Feb 04, 2005 22:15
I'm trying to figure out HOW to change the archive mode, so that two blogs can have different archive settings (one monthly & the other post-by-post).
The good news is that I've found the variable that controls it ($archive_mode).
The bad news is that I can't seem to figure out what to do with it.
It's not one of the URL parameters, so I can't just set $archive_mode = 'postbypost' in the stub file. Tho I tried anyway!
I tried swapping the case 'monthly' and case 'postbypost' in the _class_archivelist.php, but it results in "?()" on the archives page. No error, but no post-by-post.
I've tried hardwiring the variable in the _class_archivelist.php file, commenting out the "$this->archive_mode = $archive_mode;" line and replacing it with "$archive_mode = 'postbypost' ", with (again) the same "?()" result.
[/list:u]
I'm going in circles here! PHP gurus: any suggestions?
PS - We're using 2 installs of b2evo (subdomain blogs sharing one database), so hardwiring a core file can be a solution (until subdomains are supported).
TIA
5 autumntd Feb 07, 2005 20:50
Well, I'm new to the message board, and the archives were my problem, so I was a bit discouraged to find this post. But after some digging, I devised my own hack, which I feel I need to share with the world:
Go into the _archives.php file of your skin and find this code:
echo $archive_line_start;
switch( $Settings->get('archive_mode') )
{
case 'monthly':
And change it to this:
echo $archive_line_start;
switch( 'postbypost' ) //or 'monthly', or 'daily', or 'weekly'
{
case 'monthly':
Basically, you're replacing the call for a variable with the variable itself. Ta-da!
6 stk Feb 07, 2005 22:21
AutumnTD - I have to admit, what you write makes sense. Right now, the back office is set for 'archive monthly'. I tried hardwiring the _archive file for one blog that we want 'postbypost'. Unfortunately, I got a MySQL error!
MySQL error!
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1(Errno=1064)
Your query:
SELECT ID, post_author, post_issue_date, post_mod_date, post_status, post_locale, post_content, post_title, post_url, post_category, post_autobr, post_flags, post_wordcount, post_comments, cat_blog_ID FROM evo_posts INNER JOIN evo_categories ON post_category = cat_ID WHERE ID =
And it comes up as a link ... odd.
I'm not even certain WHERE the query is coming from, as it isn't any one of the CASE queries in the _archives file?
Funny, but I can switch it to daily, weekly (or the B.O. setting - monthly) and THEY all work fine.
Thinking that there MIGHT be more than one way to skin a cat, I set the B.O. to "postbypost", THEN changed our main blog (now postbypost), back to 'monthly' ... no error, but no archives. Weekly resulted in the same problem. However, daily resulted in a list with the SAME date (12/31/69) for each link, but they went to the proper entry.
>:-< - aargh.
This is STILL an issue for me, but THANKS for your suggestion. Perhaps ... because 'daily' works, I could just use that and then reformat the case to add "title" and such??? (OR because this will be a static blog, only old entries and no new entries, I can just make an "ARCHIVE LINKS" entry, format it the way I want and bypass archives completely - since 'monthly' makes absolutely NO SENSE for this blog) ...
Still got a few tricks up my sleeve. ;)
Welcome to B2evo! Glad you were able to solve your archive problem.
7 autumntd Feb 07, 2005 23:04
Yeah, I saw that strange MySQL error "link" as I was exploring. It's a frustrating one.
The query, I believe, is in b2evocore/_class_archives.php
If you compare that with the skins archives file, it makes a little more sense (I also tried switching the switch classes... in the class_archives, though, each switch class seems to use different elements, though.. which is why it screws up).
If daily works, but postbypost doesn't, check for typos from your previous editing. That's a pretty good sign that something's off.
But anyway, your workaround sounds like a nice ideas. :)
8 autumntd Feb 07, 2005 23:12
D'oh!
I lied. My solution only works when the global setting (back office) is set to the same value as the hack. Otherwise, you get the MySQL error.
Back to square one.
It seems like this should be much easier than it is.
9 stk Feb 08, 2005 06:21
Because b2evo is touted as a multi-blogging tool, I find it odd that the back-office setting tabs affect ALL blogs. (Initially, I was confused, because I just ASSUMED that each blog's settings could be set independently, which makes total sense to me).
We should put a blurb in the enhancement request section, suggesting that this be changed, eventually.
I'm just disappointed that no-one's been able to come up with a solution. I know WHAT I want, but I'm such a PHP noob, that I just don't know HOW to get what I want. (Leaves me waiting for some kind soul to offer up a solution).
Anyway ... let me know if you can set the archive mode, because right now (unless new suggestions come floating on the ether) I'm gonna have to bypass the whole archive thing ... since it can't seem to be set independently. (And while monthly makes total sense for our current blog, it makes absolutely no sense for the one I'm trying to change it for).
I get the impression that setting the archive in the back office puts a whole series of variables into motion, more than just switching the archive_mode back to postbypost will fix. Dunno. :'(
I share your thought that is SHOULD be much easier than what we've experienced.
Good luck.
10 edb Feb 08, 2005 08:41
My standard disclaimer applies. If you're using stubs it can probably go in the stub, but I tested this in a skin's _main file. Ready?
<?php
if( $blog == 2 ) {
$Settings->set( 'archive_mode', 'weekly' );
} ?>
So I'm guessing that if you're using stubs there is no need to ask the if part. Therefore stub users should be able to get away with:
<?php
$Settings->set( 'archive_mode', 'weekly' );
?>
Truth is stub users should be able to get away with murder. Literally. Stub users should be allowed to kill without any legal or MySQL 'issues' ruining their day, but, again, my standard disclaimer applies.
What, you may be asking yourself, is my standard disclaimer? I think.
11 stk Feb 08, 2005 16:23
I put into my stub file, the following:
$Settings->set('archive_mode','postbypost');
(Figuring you don't need the PHP start and end tags, because everything in the stub file is already inside the those tags).
This yielded an error message:
Fatal error: Call to a member function on a non-object in /home/.../blogs/pct.php on line 61
I'll try it in the _main file.
12 stk Feb 08, 2005 18:12
Works GREAT in _main.php (didn't need the "if").
The stub file ERROR just proves that stub users (nosed or otherwise) CAN'T get away with murder (literally, or figuatively). Though I wonder IF there is a way to properly set it there?
Why does $Settings->set('archive_mode','postbypost') work and not $archive_mode='postbypost'?
Ed, you're awesome. Thanks a TON for fixing this problem for us!
13 edb Feb 08, 2005 18:55
I think you'll need the if if you use the same skin for multiple blogs, or at least that's how I tested it: only blog2 went to a different archive mode in the same skin. If your skin (and therefore your _main) is only used on one blog then yeah: no need for iffing it.
Here's what I think about why the seemingly simpler method doesn't work: it doesn't look for that tidbit as a variable when it needs it. Instead it goes and checks the database for it and acts accordingly. Settings->set does a temporary change to the dbase. It's normally followed by something like dbupdate (and it's in b2evocore/_class_settings if you want to check it out) to fix the new value permanentally, but in this case you only want a short term change.
14 lostinmysphere Feb 17, 2005 14:38
would it be possible to advance this and somehow include in there
sort=post_title
order=ASC
Would it go in like that? Or would there be some other way of writing it?
15 stk Feb 17, 2005 15:41
If I understand your question correctly, you want to have the archive list (BOTH the one on your sidebar, if you have one there, AND the complete archive list) to be listed alphabetically, by post title?
If that's true, I believe that you just need to hack the _class_archivelist.php in the b2evocore folder.
Change the POST-BY-POST ARCHIVES section:
Look for "ORDER BY post_issue_date DESC" & change it to:
"ORDER BY post_title ASC"
EDIT - Tested the above and it works fine for me. Hope this helps. :)
16 lostinmysphere Feb 17, 2005 16:53
Oh thank you SO much. That was exactly what i wanted to do. It worked perfectly.
17 stk Feb 17, 2005 18:49
Glad I could help. :D
18 lostinmysphere Feb 17, 2005 20:36
I don't suppose you can set one blog to operate slightly differently? i.e. month by month, whilst all the others use the post by post?
19 stk Feb 17, 2005 23:04
THAT was what I wanted to do and WHY I started this post in the first place.
I was VERY surprised to discover that the Back Office Settings tab (i.e. - post-by-post, monthly or weekly archive options) affected ALL blogs of a single install. (This just didn't 'compute' for me, because b2evo is a multi-blog tool, so I would EXPECT the settings to be blog independent). (Been meaning to write a post in 'feature request' for this, as I think it is important ... maybe you'll beat me to it?) ;)
But those settings are NOT blog-independent. So ... the 'out of the box' answer is "NO", the settings that are available in the back office affect all blogs ... it's an either/or situation.
However, as you saw from my simple hack solution to your earlier request, you can accomplish a LOT by "hacking" files in b2evo.
So, I can see that the answer is really YES, you just need to come up with a way of doing it. Here's what I suggest.
In the stub file and/or index file for your blog, you can do what Graham suggested at the beginning of this post and set the number of posts to be shown for each blog THERE.
In the _main.php file for each of your blogs, you can do what Ed suggests and put in the code:
<?php
if( $blog == # ) {
$Settings->set( 'archive_mode', '[weekly/monthly/postbypost or daily]' );
} ?>
Where #=the internal blog number
and [weekly/monthly... daily] are archive choices (i.e. - just pick ONE)
You would need to (1) know the blog number and (2) add the code prior to where your _main.php calls for the archive to be displayed and the link the the arcdirurl in your sidebar.
I would THINK that this should do it, but you'd have to test it.
The person that would know FOR SURE, would be EdB.
Also, the nice thing about this "hack" is that it affects files that aren't modified during an upgrade. You don't have to remember what you did ... just set it & forget it! B)
Cheers. :)
Let me know if it works out.
20 lostinmysphere Feb 18, 2005 01:43
ah okay. Thats really cool.
I'll play around with it tomorrow (far too tired now). But yeah, I'll come back and let you know how it goes.
Thanks again.
21 lostinmysphere Feb 18, 2005 17:08
I tried adding in
if( $blog == 2 ) {
$Settings->set( 'archive_mode', 'monthly' );
}
into the _main.php but the archive didn't change...
Maybe im doing something wrong. I put it directly about the line that reads:
ase 'arcdir':
// this includes the archive directory if requested
require( dirname(__FILE__).'/_arcdir.php');
break;
Should i put it elsewhere?
22 stk Feb 19, 2005 01:25
I don't know what to tell you. In the Back Office (BO) of our main blog, I normally have archive mode set to monthly. So, just for grins, I added the code & changed it to 'postbypost'. Worked fine.
Then I changed the BO setting to daily and changed the code to 'monthly', again worked just fine.
1) Check the syntax and make sure that it's
<?php if($blog==7){
$Settings->set('archive_mode','monthly'); } ?>
If a curly brace is missing or a space isn't in the right place ... well, I'm sure I'm not telling you anything you don't already know. It's picky!
2) Are you SURE that you've got the right blog #? (When I first tested, I forgot to change your post==2 to my post==7 & got nothing).
3) I put it a bit higher than the file call, but I don't see why it wouldn't work where you put it.
What's the BO archive settings?
You could try adding it to the _archives.php file instead, but frankly, if it works for EdB AND me in _main.php, I don't see why you would need to do that.
Have a look then we'll go from there.
23 lostinmysphere Feb 19, 2005 11:00
Okay, well i put it much higher up in the code and it worked perfect.
Thank you so much.
24 stk Feb 19, 2005 16:03
I'm glad you got it working. (Partly because I was running out of ideas ;) )
25 ferf Nov 09, 2007 16:20
Hi people! I'm trying to have different options of archive to different blogs. This is important to my site, but I wasn't able to do that. I tried to change the _main.php, but it didn't work. And I don't have a "archive.php" in my lits of templates. What can I do? My site is http://fernandafranca.com/in/index.php? I want all the blogs to be archived post by post, but only blog 5 to be archived monthly. Is that possible? Please help me. And sorry for my english.
Not too sure about the archives, but you can limit the number of posts when you're using stub files by sticking the following code in just before the b2evo magic file is called that makes it all work
Change the 1 for however many posts you want.