Recent Topics

1 Jan 15, 2006 07:19    

Hi, I asked this question in the past but was unable to figure out how to work the solution.

Here is the code in my _main.php file that displays the blog posts I make:

<?php // ------------------------------------ START OF POSTS ----------------------------------------
if( isset($MainList) ) $MainList->display_if_empty(); // Display message if no post

if( isset($MainList) ) while( $Item = $MainList->get_item() )
{

?>
<div class="bPost" lang="<?php $Item->lang() ?>">
<?php
locale_temp_switch( $Item->locale ); // Temporarily switch to post locale
$Item->anchor(); // Anchor for permalinks to refer to
?>
<div class="bSmallHead">

<?php


$Item->categories();

?>
</div>
<h3 class="bTitle"><?php $Item->title(); ?></h3>
<div class="bText">
<?php $Item->content(); ?>
<?php link_pages() ?>
</div>

============

I would like to know how I can call on just one specific category. Is there a way to call on the category by number?

I would like to display my front page like a newspaper of sorts and always have the category posts display in the same spot.

When posting your suggestions, please keep in mind that I know very little about PHP.

Thanks for the help all.

2 Jan 15, 2006 19:57

You can do that, you just need to create a new object for the ItemList like so:

        <?php
                // You can restrict to specific categories by listing them in the two params below: '', array()
                // '', array(9,15) will restrict to cats 9 and 15
                // '9,15', array() will restrict to cats 9,15 and all their subcats
                $BlogBList = & new ItemList( $blog,      $show_statuses, '', $m, $w, '', array(), $author, $order, $orderby, $posts, '', '', '', '', '', '', '', '4', 'posts', $timestamp_min, $timestamp_max );

                while( $Item = $BlogBList->get_item() )
                {
                ?>
                <p>
                        <?php $Item->anchor(); ?>
                                <?php $Item->content( 1, false ); ?>
                                <?php link_pages() ?>
                </p>
                <?php
        ?>

3 Jan 21, 2006 12:53

wow ! Thanks so much for this great reply. I'm really happy to hear there's a way to do it. Unfortunately, I really don't know how to use the information you've given me. Could you please give me a quick run down on how to add this into my _main.php file?

Thanks for all your help!

4 Jan 21, 2006 23:39

Sorry, I should have been more clear. I was in a hurry. Try this. Find this part of your _main.php file:

<?php // ------------------------------------ START OF POSTS ----------------------------------------
if( isset($MainList) ) $MainList->display_if_empty(); // Display message if no post


And add these line in between:

<?php // ------------------------------------ START OF POSTS ----------------------------------------
// You can restrict to specific categories by listing them in the two params below: '', array()
                // '', array(9,15) will restrict to cats 9 and 15
                // '9,15', array() will restrict to cats 9,15 and all their subcats
$MainList = & new ItemList( $blog,      $show_statuses, '', $m, $w, '', array(), $author, $order, $orderby, $posts, '', '', '', '', '', '', '', '4', 'posts', $timestamp_min, $timestamp_max );
if( isset($MainList) ) $MainList->display_if_empty(); // Display message if no post


I haven't tested this, but I think that should do it.


Form is loading...