Recent Topics

1 Nov 25, 2005 01:11    

issue I would like to build some portlet like mechanism to hold content but have the content be unique to a particular blog. I'm ok on the portlet content but need a mechanism to 'tell' what blog a user is looking at.

Example if a user is looking at blog=2 I'd like to have some unique content in the right column. If a user is looking at blog=3 there would be different content.

Thoughts: the topics and description of a blog must use this kind of mechanism but I cannot see where the php that handles this is exposed.

Thanks

2 Nov 28, 2005 17:43

There is a $blog variable that holds the blog number. I'm not sure how you are getting the content for your portlet, but you should be able to pass this variable to your portlet via URL (if you are accessing it from another site) or just check it directly it if the portlet code is running within your page (via include or something).

3 Nov 28, 2005 18:22

What I was thinking was similar to being able to check if a user is logged in with an if / else, and thereby display content unique to that circumstance.

Example:

<?php 
if( is_logged_in() ){ 
$readername = $current_User->get('preferedname'); 
?> 
Hello, <?php echo $readername; ?>! 
<?php 
} 
else { // show this text to non-members 
?> 
Welcome, visitor.  <a href="mailto:someaddress@domain.com">Contact me</a> if you want to become a site member. 
<?php 
} ?>

That I would be able to do an if / else but instead of checking for login I'd be able to check 'Which Blog was being viewed' and provide unique content to that circumstance.

What I don't know is the php to accomplish this. I'm assuming there is something along the lines of

if(is_blog=2)

or something ?

Attention appreciated!

4 Nov 28, 2005 19:09

This ought to do it

if ($blog == 2) 


Form is loading...