Recent Topics

1 Jan 11, 2007 10:25    

So I installed b2evolution to show news on my homepage. I like how the regular blog listings look but for my homepage I just want to keep it simple... a title, the blog text and maybe a link to the blog itself.

Look at my homepage http://www.ayasarchery.com and you can see I currently manually insert the news in the right-hand box. What is the php code I would need to insert to have b2evolution just display the post like this without anything else, on my homepage?

Thank you (and I did search but it was all over my head!)

2 Jan 11, 2007 13:02

You would make a skin
a very basic skin

How ?

Well, start with the custom skin and duplicate the whole directory to the dir mynewskin
open mynewskin/_main.php

Look for the 'postloop' and look at all the things that are on top of that.
So between <body> and the start of your postloop
kind off delete that all (make sure you don't brake <div>'s
look for the 'sidebar'
delete the whole part of that sidebar.

at that point you will be left whith a skin that is only showing posts, no categories, calendar, blogtitle, etc.
change the stylesheet,...

So see where I'm going too ?

3 Jan 12, 2007 06:00

Totally, I took care of that and created my own "stripped down" skin.

Now what php code do I use to insert the stripped down skin into my html code?

For example:


<HTML>
<BODY>
Ths is some text

Here is where I want to put the news.
<? WHAT TO PUT HERE ?>

This is the footer for this page
</BODY>
</HTML>

Thanks for your help!

4 Jan 12, 2007 13:39

Well, your stripped down skin would have all the information that you wan tto place in the area <? WHAT TO PUT HERE ?>, isn't it ?
and for the rest , your _main.php file is an entire HTML page with php-code in.

you can fill that file with all your 'static' content if you want, and use only that skin for your homepage..;

Still following ?

5 Jan 12, 2007 19:35

Ok so here is the solution I used (I am posting it here to help others if they have the same problem in the future).

I copied the a_noskin.php file in the main B2Evolution directory (whatever you named that) and named it a_forFrontPage.php. Then I edited that file to only have the following code:


<?php

$blog = 2;		// 2 is for "demo blog A" or your upgraded blog (depends on your install)
$skin = '';
$show_statuses = array();
$posts= 1; //show 1 post only 
$linkblog_cat = '';
$linkblog_catsel = array( );
$timestamp_min = '';
$timestamp_max = 'now';

require_once dirname(__FILE__).'/conf/_config.php';
require $inc_path.'_blog_main.inc.php';

	# this is what will start and end your blog links
	$blog_list_start = '<div class="NavBar">';
	$blog_list_end = '</div>';
	# this is what will separate your blog links
	$blog_item_start = '';
	$blog_item_end = '';
	# This is the class of for the selected blog link:
	$blog_selected_link_class = 'NavButton2Curr';
	# This is the class of for the other blog links:
	$blog_other_link_class = 'NavButton2';
	# This is additionnal markup before and after the selected blog name
	$blog_selected_name_before = '<span class="small"><img src="'.$rsc_url.'img/down_small.gif" width="14" height="12" alt="['.T_('Selected').']" title="" class="top" />';
	$blog_selected_name_after = '</span>';
	# This is additionnal markup before and after the other blog names
	$blog_other_name_before = '<span class="small">';
	$blog_other_name_after = '</span>';
	// Include the bloglist
	require( get_path('skins').'_bloglist.php');
	// ---------------------------------- END OF BLOG LIST --------------------------------- ?>
<!-- InstanceEndEditable -->



<?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 $Item->anchor(); ?>
		<?php $MainList->date_if_changed(); ?>
		<h3 class="bTitle"><?php $Item->title(); ?></h3>
		
		<div class="bText">
			<font color="#FFFFFF"><?php $Item->content(); ?></FONT>
			<?php link_pages() ?>
		</div>
		<div class="bSmallPrint">
			<?php $Item->feedback_link( 'comments', '', ' &bull; ' ) // Link to comments ?>
			<?php $Item->feedback_link( 'trackbacks', '', ' &bull; ' ) // Link to trackbacks ?>
			<?php $Item->feedback_link( 'pingbacks', '', ' &bull; ' ) // Link to trackbacks ?>

			<?php $Item->trackback_rdf() // trackback autodiscovery information ?>

			<?php	$Item->permanent_link(); ?>
		</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( get_path('skins').'_feedback.php');
		// ------------------- END OF INCLUDE FOR COMMENTS, TRACKBACK, PINGBACK, ETC. ------------------- ?>
	</div>
<?php } // ---------------------------------- END OF POSTS ------------------------------------ ?>

Then on my main page I wanted to insert the post on I put


<? include('news/a_forFrontPage.php'); ?>

That should work fine for you but I use B2Evolution version 1.8.6 (the newest out as of 1/10/07) and I was getting an error that the headers were already sent. I saw where the error was coming from and I edited this line (line 196) of the inc/MODEL/sessions/_session.class.php file:


			// Set a cookie valid for ~ 10 years:
			//setcookie( $cookie_session, $this->ID.'_'.$this->key, time()+315360000, $cookie_path, $cookie_domain );

I just comented it out. Now I am sure this affects something because now my cookies won't be set ... DOES ANYONE HAVE A BETTER SOLUTION FOR THIS?

But that will get you going. I got most of the info I needed from this post http://forums.b2evolution.net//viewtopic.php?t=7301 and also with Topanga's help in this thread.[/b]

6 Jan 18, 2007 00:27

Well by just commenting out that line it didn't work because since the cookie was already set on my computer everything was fine but when I went to another computer to login then it wouldn't let me.

So how can I get rid of this nasty error message:

"Warning: Cannot modify header information - headers already sent by (output started at /home/ayasarch/public_html/index.php:9) in /home/ayasarch/public_html/news/inc/MODEL/sessions/_session.class.php on line 196"

that gets displayed on the page where my simple news item is displayed?

7 Jan 18, 2007 07:10

Ok, well I have searched and searched and nothing has worked... someone please help me!!!

Thanks!

8 Jan 29, 2007 21:33

PLEASE HELP! I still can't figure this out.

How can I get the cookies still on there but not resend the headers so I don't get this warning on the main homepage...

Warning: Cannot modify header information - headers already sent by (output started at /home/ayasarch/public...

9 Jan 29, 2007 22:23

Ok so I traced it all out and I edited the file to say this:


FILE: /inc/MODEL/sessions/_session.class.php

			// Set a cookie valid for ~ 10 years:
			
if (getcwd() != "/home/ayasarch/public_html") {
	// DAVE EDIT: This means that we are calling the script from the root home directory
	// and that means for the news sidebar! Now we don't want to start a new session because this is
	// screwing up and setting a cookie which resends the headers that are already sent by the index.php file
	// and displays that nasty warning message.
	// This fix is great because it still allows her to login properly because you must set a cookie to use the admin area!
	// NOTE: This is called in this order: index.php -> a_forFrontPage.php -> inc/_blog_main.inc.php -> inc/_main.inc.php
	
	// echo "<p><font color=red size=5>CWD = ".getcwd()."</font><br><br>"; // Used to debug
			setcookie( $cookie_session, $this->ID.'_'.$this->key, time()+315360000, $cookie_path, $cookie_domain );
}

And it all works now. I hope this helps someone in the future.


Form is loading...