Recent Topics

1 Sep 21, 2005 22:21    

hey I want to do a creative thing ,

currectly the posts show bellow eachother ... I want the blog to be in 2 column or may be 3.

like 4 posts be shown under eachother in first column and the other 4 posts be shown in the next column ...

is such a thing possible ? I know this question is so general and it is not a question just for b2evo.

2 Sep 21, 2005 22:54

Anything's possible with evoskins. The trick that you'll need is to make it show the code for moving to the next column. You don't want it to show after every post, which is what it will do if you just drop the code into the loop. You want it to show after every fourth post. So, you just make a little php counter like this:


//initialize the counter and start your first div
$counter = 1;
?>
<div id="column1">
while ( $Item = $MainLinst->get_item() ) { //the loop begins
// all the code for displaying the post goes here, then right before the loop ends, check to see if you're moving to a new column.
 if ($counter == 4) { // fourth post, close the first column, open the second
        ?></div><div id="column2"> <?php 
} elseif ($counter == 8) {
?></div><div id="column3"><?php
} elseif ($counter == 12) {
?></div><div id="column4"><?php }
++$counter // move the counter up one
} // the post loop ends
?> </div>

Then just make sure you display 16 posts on each page. Use your CSS to make those divs display as columns.

3 Oct 06, 2005 14:58

hey thanks for replying me , would you please make it clear , how I should use it ?

I tried to add everything between

// ------------------------------------ START OF POSTS ----------------------------------------


and

<?php } // ---------------------------------- END OF POSTS ------------------------------------ ?>


to after


<?php //initialize the counter and start your first div
$counter = 1;
?>
<div id="column1">
while ( $Item = $MainLinst->get_item() )

and then I added the continue of your code to after them.

 if ($counter == 4) { // fourth post, close the first column, open the second
        ?></div>[b]<div id="column2">
        <?php[/b]
} elseif ($counter == 8) {?></div><div id="column3"><?php
} elseif ($counter == 12) {
?></div><div id="column4"><?php }
++$counter // move the counter up one
} // the post loop ends
?> </div>

but I get this error ...

Parse error: parse error, unexpected '}' in c:\program files\easyphp1-7\www\news\skins\natural_pink\_main.php on line 135

line 135 is this code

        ?></div><div id="column2">
        <?php


[/code]

4 Oct 06, 2005 15:16

Can you paste in lines 130-140? Or save your whole _main.php file as a .txt file and give a link to it.

5 Oct 06, 2005 17:12

<!-- =================================== START OF MAIN AREA =================================== -->

<?php //initialize the counter and start your first div
$counter = 1;
?>
<div id="column1"> 
while ( $Item = $MainLinst->get_item() ) { //the loop begins
// all the code for displaying the post goes here, then right before the loop ends, check to see if you're moving to a new column.

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

	if( isset($MainList) ) while( $Item = $MainList->get_item() )
	{
		$MainList->date_if_changed();
	?>
	<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">
		<a href="<?php $Item->permalink() ?>" title="<?php echo T_('Permanent link to full entry') ?>"><img src="rsc/img/icon_minipost.gif" alt="Permalink" width="12" height="9" class="middle" /></a>
		<?php
			$Item->issue_time();
			echo ', ', T_('Categories'), ': ';
			$Item->categories();
			echo ' &nbsp; ';
		?>
		</div>
		<h3 class="bTitle"><?php $Item->title(); ?></h3>
		<div class="bText">
			<?php $Item->content(); ?>
			<?php link_pages() ?>
		</div>
		<div class="bSmallPrint">
			<a href="<?php $Item->permalink() ?>" title="<?php echo T_('Permanent link to full entry') ?>"><?php echo T_('Permalink') ?></a>
			&bull;
			<?php $Item->feedback_link( 'comments' ) // Link to comments ?>
			<?php $Item->feedback_link( 'trackbacks', ' &bull; ' ) // Link to trackbacks ?>
			<?php $Item->feedback_link( 'pingbacks', ' &bull; ' ) // Link to trackbacks ?>

			<?php $Item->edit_link( ' &bull; ' ) // Link to backoffice for editing ?>

			<?php $Item->trackback_rdf() // trackback autodiscovery information ?>
		</div>
			<?php // ------------- START OF INCLUDE FOR COMMENTS, TRACKBACK, PINGBACK, ETC. -------------
			$disp_comments = 1;					// Display the comments if requested
			$disp_comment_form = 1;			// Display the comments form if comments requested
			$disp_trackbacks = 1;				// Display the trackbacks if requested

			$disp_trackback_url = 1;		// Display the trackbal URL if trackbacks requested
			$disp_pingbacks = 1;				// Display the pingbacks if requested
			require( dirname(__FILE__).'/_feedback.php' );
			// ---------------- END OF INCLUDE FOR COMMENTS, TRACKBACK, PINGBACK, ETC. ----------------

			locale_restore_previous();	// Restore previous locale (Blog locale)
			?>
	</div>
	<div class="separator" ><img src="rsc/img/separator.gif" width="265" height="14" /></div>
<?php } // ---------------------------------- END OF POSTS ------------------------------------ ?>

 if ($counter == 4) { // fourth post, close the first column, open the second
        ?></div><div id="column2"> 
        <?php
} elseif ($counter == 8) {?></div><div id="column3"><?php
} elseif ($counter == 12) {
?></div><div id="column4"><?php }
++$counter // move the counter up one
} // the post loop ends
?> </div>
	<p class="center"><strong>
		<?php posts_nav_link(); ?>
		<?php 
			// previous_post( '<p class="center">%</p>' );
			// next_post( '<p class="center">%</p>' );
		?>
	</strong></p>

<?php // ---------------- START OF INCLUDES FOR LAST COMMENTS, STATS ETC. ----------------
	switch( $disp )
	{
		case 'comments':
			// this includes the last comments if requested:
			require( dirname(__FILE__).'/_lastcomments.php' );
			break;

		case 'arcdir':
			// this includes the archive directory if requested
			require( dirname(__FILE__).'/_arcdir.php');
			break;

		case 'profile':
			// this includes the profile form if requested
			require( dirname(__FILE__).'/_profile.php');
			break;
	}
// ------------------- END OF INCLUDES FOR LAST COMMENTS, STATS ETC. ------------------- ?>
</div>
<!-- =================================== START OF SIDEBAR =================================== -->

6 Oct 06, 2005 17:21

Change this:


<div class="separator" ><img src="rsc/img/separator.gif" width="265" height="14" /></div>
<?php } // ---------------------------------- END OF POSTS ------------------------------------ ?>

 if ($counter == 4) { // fourth post, close the first column, open the second
        ?></div><div id="column2">
        <?php
} elseif ($counter == 8) {?></div><div id="column3"><?php
} elseif ($counter == 12) {
?></div><div id="column4"><?php }
++$counter; // move the counter up one
} // the post loop ends
?> </div>
   <p class="center"><strong>
      <?php posts_nav_link(); ?>
      <?php
         // previous_post( '<p class="center">%</p>' );
         // next_post( '<p class="center">%</p>' );
      ?>
   </strong></p>

<?php // ---------------- START OF INCLUDES FOR LAST COMMENTS, STATS ETC. ----------------

to this:

 <div class="separator" ><img src="rsc/img/separator.gif" width="265" height="14" /></div>

<?php

 if ($counter == 4) { // fourth post, close the first column, open the second
        ?></div><div id="column2">
        <?php
} elseif ($counter == 8) {?></div><div id="column3"><?php
} elseif ($counter == 12) {
?></div><div id="column4"><?php }
++$counter; // move the counter up one
 } // ---------------------------------- END OF POSTS ------------------------------------ ?>
?> </div>
   <p class="center"><strong>
      <?php posts_nav_link(); ?>
      <?php
         // previous_post( '<p class="center">%</p>' );
         // next_post( '<p class="center">%</p>' );
      ?>
   </strong></p>

<?php // ---------------- START OF INCLUDES FOR LAST COMMENTS, STATS ETC. ----------------

7 Oct 06, 2005 17:30

now I get this error

Parse error: parse error, unexpected '}' in c:\program files\easyphp1-7\www\news\skins\natural_pink\_main.php on line 141

and this is the line 141

 } // ---------------------------------- END OF POSTS ------------------------------------ ?>

8 Oct 06, 2005 17:34

Oops, I forgot the semicolon after ++$counter. I fixed it in the code above.

9 Oct 06, 2005 17:58

hey thanks a lot everythng looks great ! :) :) :)

just there is small error...

before the first post this code is showing for PEOEPEL .

while ( $Item = $MainLinst->get_item() ) { //the loop begins // all the code for displaying the post goes here, then right before the loop ends, check to see if you're moving to a new column.

I guess there should be a way to hide it. thanks again a LOT !

10 Oct 06, 2005 18:04

Just remove that code because it's in there twice and once is not even wrapped in php tags. So get rid of it. I'd like to see how it looks, can you give a link?

11 Oct 06, 2005 18:43

personman wrote:

Just remove that code because it's in there twice and once is not even wrapped in php tags. So get rid of it. I'd like to see how it looks, can you give a link?

ok thanks , I am so excited , it looks great and lovely !
I bet no blog in the world has had such a nice professional template.

I am designing the template on a localhost on my own pc,once I finish desining i will upload it and will show it to you.

thanks again .

12 Oct 09, 2005 15:06

I'd love to see this. I'm hoping to have a stab atdoing the same thing


Form is loading...