Recent Topics

1 Sep 28, 2005 14:13    

I set up a new blog just for events. Now I want to display the calendar of the event-blog (blog#2) in the sidebar of the normal blog (blog#1)

What I did: I edited the _calendar.php-file of blog#1: Just changed the variable $blog to the number of blog#2 (in my case 7). The calendar displays correctly, only highlighting the dates where there are posts in blog#2. BUT: The links fail. Instead of addressing the correct posts in blog#2 they address posts in blog#1.

For example if I click on 28/9/2005 it should take me to

blogs/index.php/blog#2/2005/09/28/


but it takes me to

blogs/index.php/blog#1/2005/09/28/

I really wasn't able to find the place to change this behavior. Maybe there is an easier way to do this.

Thanks.

2 Sep 30, 2005 12:41

Maybe providing the links to my blog will help...
The standard-blog (blog#1 in previous post) can be found at:
http://lars.wahnmache.de/blogs/index.php/polit

The events-blog (blog#2) can be found at:
http://lars.wahnmache.de/blogs/index.php/termine/

Right now I changed everything back, but all I did so far was to include the calendar in the sidebar and change the variable in _calendar.php ("7" instead of "$blog")

I fooled around with the files that might be related to the calendar-function quite a bit, but since I'm not a coder, I still don't understand what's going on and I'm not sure which files are relevant. I looked at these:

skins/custom/_calendar.php  [skin directory blog1]
skins/custom2/_calendar.php [skin directory blog2]
skins/_calendar.php [what do the files in the skin directory do anyway?]
b2evocore/_class_calendar.php

While fooling around I also took a look at the /skins/ _linkblog.php file. I found this in there:

	// Dirty trick until we get everything into objects:
	$saved_blog = $blog;  
	$blog = $linkblog;


and at the end of the file:

	// Restore after dirty trick:
	$blog = $saved_blog;		


I think this changes the $blog-variable for the time it takes to generate the linkblog (which is a separate blog just like my events-blog) and then changes it back so the rest of the page is generated normally. If this is correct, could I do something similar?
In the case I just demonstrated my complete ignorance concerning php I hope you had a good laugh. Thanks for reading.

3 Sep 30, 2005 15:28

Yes, you would want to store the $blog variable before your calendar displays, then restore it after the calendar so it doesn't mess up anything else on your sidebar. But that doesn't explain why the links in the calendar are pointing to the wrong blog. Go back to the stock calendar file, then try putting this right before your calendar include:

     // Dirty trick until we get everything into objects:
   $saved_blog = $blog; 
   $blog = 7;


And this right after:

   // Restore after dirty trick:
   $blog = $saved_blog;

4 Sep 30, 2005 16:47

I put this in the _main.php-file:

 // Dirty trick until we get everything into objects:
   $saved_blog = $blog;
   $blog = 7; 

   require( dirname(__FILE__).'/_calendar.php' );
			
   // Restore after dirty trick:
   $blog = $saved_blog; 

But still have the same behavior as in the first post. Calendar shows, links don't work.

I figure that there must be some other variable that is used for putting the links together, put I didn't find it and thus can't do another "dirty trick".

5 Sep 30, 2005 17:14

/skins/yourskin/_main.php calls
/skins/yourskin/_calendar.php, which calls
/skins/_calendar.php, which gets all it's functions from
/b2evocore/_class_calendar.php, which builds the links using
archive_link(), a function that is defined in
/b2evocore/_functions_template.php

The archive_link() funtion has $file as one of it's parameters. That's where the first part of the url will come from. I don't know how to change the behavior, but those are the files you'll have to work with. For some reason, when you change $blog to 7 up in _main.php, it's not making it all the way to the archive_link() function.

6 Sep 30, 2005 17:50

$save_Blog=$Blog;
$save_blog = $blog;
$Blog = Blog_get_by_ID(3);
$blog = 3;
			require( dirname(__FILE__).'/_calendar.php' );
$Blog = $save_Blog;
$blog = $save_blog;

¥

7 Oct 02, 2005 12:02

thanks a lot, that did it.


Form is loading...