Recent Topics

List

Started by on Nov 07, 2005 – Contents updated: Nov 07, 2005

Nov 07, 2005 05:48    

I saw something on another blog system that I liked and wished it was here. Basically when you click a category, it will list all of the blogs in that category on the right--using the titles as the links. I would like to see that here.

Nov 07, 2005 17:54

As you probably know, b2evolution doesn't currently have a way of putting blogs into categories. Posts go into categories, and categories are grouped into a blog. But when you have many blogs it might be useful to group up the blogs to keep them organized. To avoid confusion we should call this something besides categories. Maybe 'blog type' or 'blog group' or 'blog category' wouldn't even be too bad. It wouldn't actually be too hard to do. An extra column in the blogs table and probably an extra table to keep track of names and ids. A site I'm working with has something like this. If you really want to do it and aren't afraid to dig into the code and hack around, then I could try to help you.

Nov 07, 2005 20:32

I didn't know this about the category issue, I just installed this on the 5th....thanks for letting me know. I was thinking all that had to be done was strip down the posting script in the _main.php to just show the title and put it wherever I needed to in the sidebar....but as you stated that wont work, and I tried with my very limited ability.

personman wrote:

If you really want to do it and aren't afraid to dig into the code and hack around, then I could try to help you.

HA! me!?! I can't write code, I can only hack around to EVENTUALLY get what I need on rare occasions when I'm lucky. I'll be happy to work with you on what ever I can possibly do---which is not a lot.

What I'm thinking is the script would:
1/ Detect what category is currently being displayed
2/ Call that category in the database, by ID or whatever, and display a list of link titles down the sidebar.
3/ There would have to be a way to set the number of items blogs to list.
4/ And a way to order the list, by date, alphabetically, and maybe even admin selectable of the ones to display.

Nov 07, 2005 20:50

I think I misunderstood your original post. When you said

. . . it will list all of the blogs in that category on the right . . .

I thought you were talking about having multiple weblogs and assigning them categories. But now I think you meant posts. We need to understand each other or we'll never get anywhere. Here are the words and meanings as they're usually used.

[url=http://en.wikipedia.org/wiki/Blog]Blog[/url] - A blog is website that contains written material, links or photos being posted all the time, usually by one individual, on a personal basis. The term is a shortened form of weblog, although the latter term has since fallen into disuse.

Post - an individual entry in a blog.

Now, did you mean you want to be able to click on a category in the sidebar and have links to *posts* that belong to that category show up in the sidebar?

Nov 07, 2005 21:33

Ok, now I see. So, to be clear, right now when you click on a category in the sidebar, the page reloads and shows the last x posts from that category in the main area. Is that not working for you? Do you want to show the post titles in the sidebar AND the full posts in the main area? That's kind of redundant. Do you want to show only older post titles in the sidebar, the ones that don't display in the main area? Or do you want the main area to keep showing the newest posts (from all categories) and have only the sidebar change? You need to still allow a way for readers to find your oldests posts in any given category.

Nov 07, 2005 22:44

Yes that is what I want to do. I "basically"(because I havne't really gone through it yet) found it. It is:

Code

<div class="bSideItem">
   <h3><?php echo T_('The latest in this section') ?></h3>
   <ul>
   <?php
   $BlogBList = new ItemList( $blog,  '', '', '', '', '', array(), '', 'DESC', '', '', '', '', '', '', '', '', '', '5', 'posts' );
   while( $BlogBList->get_item() )
   {
   ?>
   <li lang="<?php the_lang() ?>">
   <a href="<?php permalink_link() ?>" title="<?php echo T_('Permanent link to full entry') ?>"><?php the_title( '', '', false ); ?></a>
   </li>
   <?php
   }
   ?>
   </ul>
   </div>

What I want to know is what each of the things left out in the code in the following does

Code

$BlogBList = new ItemList( $blog,  '', '', '', '', '', array(), '', 'DESC', '', '', '', '', '', '', '', '', '', '5', 'posts' );

That's kind of redundant.

Not really. It works while reading an actual post, which is what I really want it for. Also, in my categories I have my categories listed by dates, so if I only have one post today, it will show the four posts from yesterday as well since I limited mine to 5. So this works perfectly for me even in the category section.

Do you want to show only older post titles in the sidebar, the ones that don't display in the main area?

What I'd really like to do is to select which posts I'd like to display from within the admin....but I know that would be a whole lot of coding, so I'll settle with the most recent.

Nov 07, 2005 23:54

Yes, that's perfect. One last thing and then I'm done. How do I put the comment count at the end of each title? I tried, but I'm getting errors.

Nov 08, 2005 03:12

Code

<?php $Item->feedback_link( 'comments' ) // Link to comments ?>

Check this page to customize how it looks:

http://doc.b2evolution.net/0.9.0/evocore/Item.html#methodfeedback_link

For instance, to show just the number of comments in parenthesis, do like this:

Code

<?php $Item->feedback_link( 'comments', '(', ')', '0', '1', '%d', 'Comments on this post' ) // Link to comments ?>

Nov 08, 2005 04:20

The first one is actually exactly what I tried the first time when I was getting the errors. I tried the second one you did, and the same error.

Code

Fatal error: Call to a member function on a non-object in /.../blah/.../blah/ on line 269

The error being the line I put that piece of code on. So then what am I missing?

Nov 08, 2005 04:54

You can't use $Item->some_function(); unless you're in the post loop. Can you show the block of code around that line? Maybe 20 lines before and ten after.

Nov 08, 2005 06:40

Here, it's right in the middle.

Code

<!-- =================================== START OF SIDEBAR =================================== -->
 
<div class="bSideBar">
 
  <div class="bSideItem">
    <h3><?php $Blog->disp( 'name', 'htmlbody' ) ?></h3>
    <p><?php $Blog->disp( 'longdesc', 'htmlbody' ); ?></p>
    <p class="center"><strong><?php posts_nav_link( ' | ', '< '.T_('Previous'), T_('Next').' >' ); ?></strong></p>
    <!--?php next_post(); // activate this if you want a link to the next post in single page mode ?-->
    <!--?php previous_post(); // activate this if you want a link to the previous post in single page mode ?-->
    <ul>
      <li><a href="<?php $Blog->disp( 'staticurl', 'raw' ) ?>"><strong><?php echo T_('Recently') ?></strong></a> <span class="dimmed"><?php echo T_('(cached)') ?></span></li>
      <li><a href="<?php $Blog->disp( 'dynurl', 'raw' ) ?>"><strong><?php echo T_('Recently') ?></strong></a> <span class="dimmed"><?php echo T_('(no cache)') ?></span></li>
    </ul>
    <?php // -------------------------- CALENDAR INCLUDED HERE -----------------------------
      require( dirname(__FILE__).'/_calendar.php' );
      // -------------------------------- END OF CALENDAR ---------------------------------- ?>
    <ul>
      <li><a href="<?php $Blog->disp( 'lastcommentsurl', 'raw' ) ?>"><strong><?php echo T_('Last comments') ?></strong></a></li>
    </ul>
  </div>
 
<!--------------------POST TITLE LINKS BEGINS------------------------->
<div class="bSideItem">
   <h3><?php echo T_('The latest in this section') ?></h3>
   <ul>
   <?php
   $BlogBList = new ItemList( $blog,  '', '', '', '', '', array(), '', 'DESC', '', '5', '', '', '', '', '', '', '', '', 'posts' );
   while( $BlogBList->get_item() )
   {
   ?>
   <li lang="<?php the_lang() ?>">
   <a href="<?php permalink_link() ?>" title="<?php echo T_('Permanent link to full entry') ?>"><?php the_title( '', '', false ); ?></a>
   </li>
   <?php
   }
   ?>
   </ul>
   </div>
<!--------------------POST TITLE LINKS ENDS------------------------->
 
  <div class="bSideItem">
    <h3 class="sideItemTitle"><?php echo T_('Search') ?></h3>
    <?php form_formstart( $Blog->dget( 'blogurl', 'raw' ), 'search', 'SearchForm' ) ?>
      <p><input type="text" name="s" size="30" value="<?php echo htmlspecialchars($s) ?>" class="SearchField" /><br />
      <input type="radio" name="sentence" value="AND" id="sentAND" <?php if( $sentence=='AND' ) echo 'checked="checked" ' ?>/><label for="sentAND"><?php echo T_('All Words') ?></label><br />
      <input type="radio" name="sentence" value="OR" id="sentOR" <?php if( $sentence=='OR' ) echo 'checked="checked" ' ?>/><label for="sentOR"><?php echo T_('Some Word') ?></label><br />
      <input type="radio" name="sentence" value="sentence" id="sentence" <?php if( $sentence=='sentence' ) echo 'checked="checked" ' ?>/><label for="sentence"><?php echo T_('Entire phrase') ?></label></p>
      <input type="submit" name="submit" class="submit" value="<?php echo T_('Search') ?>" />
    </form>
  </div>

Nov 08, 2005 15:05

Where did you get that code? Look in /skins/custom/_main.php to get the right code. I think you need to have $Item->permalink() rather than just permalink().

Nov 08, 2005 22:14

Nope. They don't work. What else you got?
.......by the way, thanks for your help so far.

Nov 08, 2005 22:17

I'm just about out of ideas. What do you have that's working so far?

Nov 08, 2005 22:22

It's working fine as far as displaying the recent posts. I just want to show the comment count per post as well.

Nov 08, 2005 23:31

You are the MAN!!!!!!!! That did it. Thanks for all your help and your prompt responses. You've restored my faith in these script message board communities.


Form is loading...

b2evolution CCMS – This forum is powered by b2evolution CMS, a complete engine for your website.