boardom Forum Index boardom
b2 message board
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Index by category
Goto page Previous  1, 2
 
Post new topic   Reply to topic    boardom Forum Index -> How to ?
View previous topic :: View next topic  
Author Message
edica



Joined: 13 Apr 2003
Posts: 3

PostPosted: Sun Apr 13, 2003 10:02 am    Post subject: Reply with quote

Code:

$cat = 1;   // <<<< preset to cat X
if (empty($HTTP_POST_VARS['cat'])) {
    if (!empty($HTTP_GET_VARS['cat'])) {
        $cat = $HTTP_GET_VARS['cat'];
    }
} else {
    $cat = $HTTP_POST_VARS['cat'];
}

[/quote]

does that go in the index.php or blog.header?
_________________
http://dugla.net/
http://dugla.net/captured
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address
sabotage



Joined: 15 Jul 2003
Posts: 36

PostPosted: Thu Jul 17, 2003 11:34 am    Post subject: Reply with quote

omg!
excellent piece of code macshack =)

*edit
i'm having the same problem as Celia, extended posts in $cat="2" (in example) won't show when you click them....the entire post won't, it's all just a blank page.
plus i can't post comments either on posts in cat=2....

in other words, posts show up everywhere like they are supposed to, but when a category is NOT equal to cat=1 it won't comment or extend posts...

and i can't find the friggin' problem, been looking for several hours already =\
could someone take another look? www.noxious.org is my b2 blog, the To-Do List is category 2, which won't work...

btw, b2 is installed in a separate b2 folder (e.g. www.noxious.org/b2) but the index.php is in the root dir. everything else works fine though, when i don't put the piece of code macshack made in the index.php page it's all working, except for the fact that then all posts show up on the main page )

thanks in advance
Back to top
View user's profile Send private message
sabotage



Joined: 15 Jul 2003
Posts: 36

PostPosted: Sat Jul 19, 2003 7:39 pm    Post subject: Reply with quote

ok..... i'm trying to narrow it down to see what the actual problem is, but i'm not getting any further...

it seems that when i use macshack's code, the posts won't show either if i use
Code:
http://www.noxious.org/index.php?p=7
in my webbrowser. (post 7 is a post in the 2nd category).
however, if i remove mac's code, it does work. so my guess is it should be in that piece of code.... the only problem is...i don't have a CLUE what the solution would be

so.....anyone with an idea for a solution? i've tried to look for other 'blank' threads, but no luck so far...
Back to top
View user's profile Send private message
sabotage



Joined: 15 Jul 2003
Posts: 36

PostPosted: Mon Jul 21, 2003 6:46 pm    Post subject: Reply with quote

*bump*.... anyone?

*edit:

alright.... i've found out that i CAN view posts if i put the category in the url ( i.e. www.noxious.org/index.php?p=7&cat=2 )

Code:
$cat = 1;   // <<<< preset to cat X
if (empty($HTTP_POST_VARS['cat'])) {
    if (!empty($HTTP_GET_VARS['cat'])) {
        $cat = $HTTP_GET_VARS['cat'];
    }
} else {
    $cat = $HTTP_POST_VARS['cat'];
}



so my guess is that the category preset (which is set in macshack's code above) is being passed around in other categories too.
not that weird really, but isn't there another way besides having to pass the category in the url of every post?
i dunno if the solution might be in the b2template.functions.php or whatever file, so i'm begging you, point me in the right direction Smile
Back to top
View user's profile Send private message
wester3



Joined: 24 Jul 2003
Posts: 4

PostPosted: Thu Jul 24, 2003 1:54 pm    Post subject: Reply with quote

thanks! i love b2, and this sounds like a great extra feature i'd like

but i'm having a couple of problems with it, similar to those above, see http://www.tidakada.com/board/viewtopic.php?p=17608#17608

thanks
Back to top
View user's profile Send private message
macshack



Joined: 17 Jul 2002
Posts: 1204
Location: Phoenix, Az

PostPosted: Fri Jul 25, 2003 5:25 pm    Post subject: Reply with quote

Hi,

I got a PM message from sabotage on this issue and I'll see what I can do. But first I think I need to take a moment and review this thread a bit to "refresh" the ole brain....

In the mean time, would one of you describe what it is that your trying to accomplish?

I'll go read now.
Michael e
Back to top
View user's profile Send private message Send e-mail
sabotage



Joined: 15 Jul 2003
Posts: 36

PostPosted: Fri Jul 25, 2003 6:30 pm    Post subject: Reply with quote

thanks macshack, i'll try to explain what i was hoping for...

i'm trying to get my index page to show posts from category 1 only when you visit the main site. the other categories still exist, and can still be seen, but those other posts shouldn't be on the 'main' page, but only viewable if you click and go to that specific category.

now, when i put $cat=1 after the $blog statement, i had the same problem as vermifuge, which is that no matter what category i clicked in the menu, it only showed the posts from category 1.
that's when your code came in handy, it fixed the problem, made only category 1 posts appear on the main page, and the rest wasstill accessible.

however, i (and celia before me) stumbled upon the problem that now, when i click the comments link, or add a <!-- more --> tag and click it, the post itself won't show, and neither will the comments or the 'more' part. (for the other categories that is, category 1 still works perfectly).

you can check it out on www.noxious.org , only category General is showing on the main page now, try to click one of the posts in the To-Do List category, and you'll see the problem i'm having with the comments/posts/more feature.

many thanks in advance, i hope it can be worked out....

sabotage
Back to top
View user's profile Send private message
macshack



Joined: 17 Jul 2002
Posts: 1204
Location: Phoenix, Az

PostPosted: Fri Jul 25, 2003 7:22 pm    Post subject: Reply with quote

Hi,

The referenced code worked most of the time (and I guess as expected for a number of users.) And it also contained the checks to test if the "cat" query was in the url/post and set $cat accordingly. This works fine until other things are included in the url that should not be category "filtered" as in the "comments" case.

What the following code does is set the $cat variable only if there is not a "GET" or "POST" query being passed. Thus in the cases where a comment is being made for a specific post number then the $cat variable is not set and is left to the blog.header.php code to set it if it needs too.

So this should do the above:
Code:

if( empty($HTTP_GET_VARS) && empty($HTTP_POST_VARS)) {
   $cat = 2;   // <<<< preset to cat X
}


This replace the referenced "hack" in total and goes in the same place.
Tested with b2 0.6.2.1 / php 4.2.1; popup and non-popup index file
_________________
Kind Regards,
Michael e
Back to top
View user's profile Send private message Send e-mail
sabotage



Joined: 15 Jul 2003
Posts: 36

PostPosted: Sat Jul 26, 2003 6:54 pm    Post subject: Reply with quote

macshack....

i love you....



Back to top
View user's profile Send private message
szac



Joined: 02 Aug 2003
Posts: 1

PostPosted: Sat Aug 02, 2003 3:23 am    Post subject: looks great Reply with quote

Hello, this seems like a great addition to my b2blog, but i am getting a parse error when I try to add the hack. Here's what I got:

Quote:
<?php /* Don't remove this line, it calls the b2 function files ! */ $blog=1;
if( empty($HTTP_GET_VARS) && empty($HTTP_POST_VARS)) {
   $cat = 2;   // <<<< preset to cat X
} include ("blog.header.php"); ?>



does anyone know why this would happen? and if so could you please post the correct way to insert the hack?

thanks in advance!
p.s. I am enjoying the flexibility of this software!
Back to top
View user's profile Send private message
sabotage



Joined: 15 Jul 2003
Posts: 36

PostPosted: Fri Aug 15, 2003 12:08 pm    Post subject: Reply with quote

szac, could you post the parse error you get?
since i don't see any errors in the code above, so it must be something else.

anyway, i stumbled upon a new issue with this thing, which is that now the main page not only shows the last 5 posts, but it shows ALL posts as if i was looking at an archive. it shows all the posts in the category.... how can i fix it so it'll only show the last 5 posts again...?

cheers,

sabotage (back from holiday )
Back to top
View user's profile Send private message
sabotage



Joined: 15 Jul 2003
Posts: 36

PostPosted: Sun Oct 05, 2003 6:26 pm    Post subject: Reply with quote

heh, dead thread probably but i'll try again, i still haven't been able to figure out why the post limiting thing won't work with this piece of code.

anyone have any bright ideas?
Back to top
View user's profile Send private message
karidee



Joined: 09 Jul 2003
Posts: 6

PostPosted: Mon Jan 26, 2004 7:16 pm    Post subject: Reply with quote

redg8r wrote:
Nice work

Can we take it up a notch & show lates post in every category, nested in a table?

I can do the template, just fuzzy on the DB query

I'm wanting to use the blog as a newsletter & being able to show the latest post in each category, from one central page would rock.

any ideas?

Thanks


Hey this idea is what I'm looking for. I've triumphed over the template issue and have been able to get my blog to match the rest of my site. But now I'd like to have only one category show up on my main page and the whole blog on a different one. If my blog is in a seperate folder called blog and my main page is in the main directory and called main.htm how could I get it to display only one of my categories?
Back to top
View user's profile Send private message
karidee



Joined: 09 Jul 2003
Posts: 6

PostPosted: Fri Jan 30, 2004 7:58 pm    Post subject: Reply with quote

bump
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    boardom Forum Index -> How to ? All times are GMT + 1 Hour
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB 2 © 2001, 2002 phpBB Group