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 

Categories linking to title-only lists
Goto page 1, 2  Next
 
Post new topic   Reply to topic    boardom Forum Index -> How to ?
View previous topic :: View next topic  
Author Message
Bonnie



Joined: 14 Aug 2002
Posts: 1

PostPosted: Wed Aug 14, 2002 1:34 pm    Post subject: Categories linking to title-only lists Reply with quote

I apologise if this question has been asked elsewhere, but I've been searching the forums for the past hour and haven't found what I need, so I'm taking the risk of being flamed by posting my query. *Scared*

I have a menu on my site which has my different categories on it, let's call them red, yellow, green and blue. The menu currently calls up options like these:

colours.php?cat=1
colours.php?cat=2
colours.php?cat=3
colours.php?cat=4


What I really want, is to click on 'red' and get a list of all of the post titles for that category, listed in alphabetical order, with each post title linking to that actual post. I don't want any sort of extra things next to the titles (ie. date/time or comments links)... in fact I don't want any kind of date-sorted archive at all, as I'm using this for a writing site and will be putting my old writing archives into it.

I'm not very good at explaining things, and I'm completely new to PHP. I've been reading through some of the hacks which sound similar but not quite what I want. I have no idea how to modify them to make them do what I want.

Does anyone know what I'm talking about, and how I could solve this problem?
Back to top
View user's profile Send private message
kilo



Joined: 02 Dec 2002
Posts: 12

PostPosted: Mon Dec 02, 2002 7:47 am    Post subject: Reply with quote

I'd love a solution to this also.
Back to top
View user's profile Send private message
ahotasu



Joined: 02 Dec 2002
Posts: 13
Location: Piedmont College

PostPosted: Mon Dec 02, 2002 7:30 pm    Post subject: Reply with quote

colours.php should have the same basic b2 loop layout as index.php

except the display within the b2 loop would be something like:

Code:
<a href="<?php permalink_link() ?>"><?php the_time() ?><?php the_title(); ?></a>


your link should be:

colours.php?orderby=title&order=ASC&cat=1
colours.php?orderby=title&order=ASC&cat=2
colours.php?orderby=title&order=ASC&cat=3
colours.php?orderby=title&order=ASC&cat=4

or if you want descending order, simply leave the order string out...
Back to top
View user's profile Send private message Visit poster's website AIM Address
kilo



Joined: 02 Dec 2002
Posts: 12

PostPosted: Tue Dec 03, 2002 1:51 am    Post subject: Reply with quote

The problem is when you use this click on the title link generated by colours.php, it then calls colours.php again to generate the post. This brings up a post which consists of only the title.

Is there anyway to force colours.php to create links that point to index.php ? - this would solve the problem
Back to top
View user's profile Send private message
macshack



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

PostPosted: Tue Dec 03, 2002 3:34 am    Post subject: Reply with quote

Hi,

In the b2loop on the 'color.php' page use this (or somthing very close):
Code:

<a href="index.php?p=<?php the_ID() ?>"><?php the_title(); ?></a><br />


This will link back to the main page. (If your main page is not index.php, change the above to whatever it is)

Michael e
Back to top
View user's profile Send private message Send e-mail
kilo



Joined: 02 Dec 2002
Posts: 12

PostPosted: Tue Dec 03, 2002 4:02 am    Post subject: Reply with quote

thanks, that is great..
Back to top
View user's profile Send private message
zodiac



Joined: 14 Apr 2002
Posts: 11

PostPosted: Sat Feb 22, 2003 5:17 am    Post subject: that's perfect, one last modification... Reply with quote

this thread is exactly what I wanted, with one slight modification: how would I order the title list by date instead of alphabetically?

many thanks, and thanks for b2!

-Paula
Back to top
View user's profile Send private message Visit poster's website
alex_t_king



Joined: 09 Oct 2002
Posts: 194

PostPosted: Sun Feb 23, 2003 6:29 pm    Post subject: Reply with quote

I believe using the default b2 loop and setting the category will actually give you the entries in chronological order.
_________________
Yahoo! Messenger ID: alex_t_king
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
zodiac



Joined: 14 Apr 2002
Posts: 11

PostPosted: Sun Feb 23, 2003 7:04 pm    Post subject: Reply with quote

that is how I originally had it set up, but it lists the entries in their entirety rather than by title alone. I tried playing around with the query string but had no luck.
Back to top
View user's profile Send private message Visit poster's website
macshack



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

PostPosted: Mon Feb 24, 2003 8:13 am    Post subject: Reply with quote

Hi,

A picture is worth a bunch of words...

What is it that you are trying to do? Be a little more descriptive or draw us a picture (albiet a text one would do). I say this because I think we are not communicating too well (could be we are just not listening). But don't give up on us yet. Very Happy
_________________
Kind Regards,
Michael e
Back to top
View user's profile Send private message Send e-mail
zodiac



Joined: 14 Apr 2002
Posts: 11

PostPosted: Mon Feb 24, 2003 8:27 am    Post subject: Reply with quote

oh, no problem :)

You can see what I'm trying to do here: http://stonerwitch.net. Just click on any of the "archive by subject" links and it will take you to a list of titles posted under each category.

Its set up exactly as I want it right now, except that I want the entry titles to list by date, instead of alphabetically.

Hope that's a little more useful! :)

-Paula
Back to top
View user's profile Send private message Visit poster's website
macshack



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

PostPosted: Mon Feb 24, 2003 10:06 am    Post subject: Reply with quote

Hi Paula,

What is the code in "archivelist.php" script? Is it a typical b2 template? Or is is some special code that was written?

The reason I am asking is, if archivelist.php page is a basic b2 template, the the query is all done in blog.header.php. If that is the case and what you want is the list ordered by the date, then just remove the "orderby=title" from the query string that called the page. That is be cause the default order will be by date. You are also passing the order as 'ASC', which is fine for assending dates. I think that is all you would have to do. The result will be what you have now, but with ordered dates

So, the links on your main page must be changed to remove the 'orderby' clause. they would look like:
Code:

http://stonerwitch.net/archivelist.php?order=ASC&cat=24

In fact you can check if this is what you want. Just click on one of the main page links, and then when you on that page with the titles in the wrong date order, just edit the url to remove the the orderby=title and press enter. The page is now what you wanted; correct?
_________________
Kind Regards,
Michael e
Back to top
View user's profile Send private message Send e-mail
zodiac



Joined: 14 Apr 2002
Posts: 11

PostPosted: Mon Feb 24, 2003 5:26 pm    Post subject: Reply with quote

hi again,

okay, I took out the orderby clause, and its giving me what I want! yay! thank you!

but now I am running into another problem: I have the b2 options set to show 10 posts, and that it is also limiting the archive list to 10 posts. is there a way to set my archivelist.php code to override that limit? The code on that page looks like this:
Code:
<!-- // b2 loop start -->
         <?php while($row = mysql_fetch_object($result)) { start_b2(); ?>
         
         <p class="main"><?php the_time("d M Y"); ?> | <a href="archive.php?p=<?php the_ID() ?>"><?php the_title(); ?></a></p>
         
         <!-- // this is just the end of the motor - don't touch that line either :) -->
         <?php } ?>
         
         <?php
         if ($debug=="1") {
            echo "<p>$querycount queries - ".number_format(timer_stop(),3)." seconds</p>";
         }
         ?>


thanks much!
-Paula
Back to top
View user's profile Send private message Visit poster's website
macshack



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

PostPosted: Tue Feb 25, 2003 8:39 am    Post subject: Reply with quote

Hi Paula,

If you have the b2options set to 'posts paged' then yes.

Try including in the url parameters '&posts=5' and that should limit the number of posts retrieved to the 5. This is the url on your main page that links to the archives:
Code:

http://stonerwitch.net/archivelist.php?order=DSC&cat=24

would become:
Code:

http://stonerwitch.net/archivelist.php?order=DSC&cat=24&posts=5

as an example. But this will not do as expected is the b2options are just set to posts because in this mode the "posts" only controls the "non-list" things like the main page. Things that generate lists (my term to try and describe what is going on) like 'm=', 'cat=', 's=', 'author=' and other are designed to generate the whole list.

Because of the need to "limit" the lists to smaller sets of data and be able to navigate through the lists, 'posts paged' was created. In this mode the code reacts to the url parameter 'posts=n' and overrides the value that was set in b2options.

If this is not acceptable, then you could put a counter in the b2 loop you posted to end the loop when the count is reached.
_________________
Kind Regards,
Michael e
Back to top
View user's profile Send private message Send e-mail
zodiac



Joined: 14 Apr 2002
Posts: 11

PostPosted: Wed Feb 26, 2003 2:09 am    Post subject: Reply with quote

Perfect! That is exactly what I wanted. Thank you very much macshack, I appreciate all your efforts at helping me. :D :D

-Paula :)
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    boardom Forum Index -> How to ? All times are GMT + 1 Hour
Goto page 1, 2  Next
Page 1 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