Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Topic started by: yourdailysaver on December 10, 2009, 01:07:06 AM

Title: One forums latest posts on another forum
Post by: yourdailysaver on December 10, 2009, 01:07:06 AM
Hello Seniors,

Here is what i want to do ,

i am running two forums using smf rc2. i want to display one forums latest 10 posts on another forums portal block. is it possible ?
Title: Re: One forums latest posts on another forum
Post by: yourdailysaver on December 10, 2009, 02:49:10 PM
Can somebody please reply its really urgent for me
Title: Re: One forums latest posts on another forum
Post by: yourdailysaver on December 11, 2009, 01:34:11 AM
hey sorry to bounce topic again but please reply seniors its really urgent
Title: Re: One forums latest posts on another forum
Post by: yourdailysaver on December 11, 2009, 03:03:37 PM
Do i accept that its not possible seniors ? give me some idea friends.
Title: Re: One forums latest posts on another forum
Post by: shumilica on December 11, 2009, 03:39:24 PM
I think it's possible via SSI. search for more information.
Title: Re: One forums latest posts on another forum
Post by: Arantor on December 11, 2009, 03:44:30 PM
First up, please DON'T bump 3 times in under a day - we're all volunteers here.

It is possible, but depending on whether the two forums run on the same server or not depends on how you end up doing it.

Can we have plenty more details about what you have and what you're trying to achieve?
Title: Re: One forums latest posts on another forum
Post by: yourdailysaver on December 11, 2009, 03:53:35 PM
sorry for that buddy . actually i have two forums both running on smf version 2.0 RC 2. i have ezportal activated on one forum and it has latest posts block in it. i want to display this block in another forum so that it will display first forums latest posts. both are on same servers.
Title: Re: One forums latest posts on another forum
Post by: Matthew K. on December 11, 2009, 03:56:24 PM
First of all, please do not bump topics within 24 hours as all of the Support Members are volunteers.

Regarding your issue, take a look at Using SSI.php (http://docs.simplemachines.org/index.php?topic=400.0)

Labradoodle-360
Title: Re: One forums latest posts on another forum
Post by: Arantor on December 11, 2009, 04:00:45 PM
Quote from: Arantor on December 11, 2009, 03:44:30 PM
It is possible, but depending on whether the two forums run on the same server or not depends on how you end up doing it.

Can we have plenty more details about what you have and what you're trying to achieve?

So, are they running on the same server or not?
Title: Re: One forums latest posts on another forum
Post by: yourdailysaver on December 11, 2009, 04:05:51 PM
i have looked at that topic but didnt find anything its for showing posts to webpage or something. sorry sir but i am not very tech savvy please can you explain in detail ?
Title: Re: One forums latest posts on another forum
Post by: yourdailysaver on December 11, 2009, 04:06:34 PM
Quote from: Arantor on December 11, 2009, 04:00:45 PM
Quote from: Arantor on December 11, 2009, 03:44:30 PM
It is possible, but depending on whether the two forums run on the same server or not depends on how you end up doing it.

Can we have plenty more details about what you have and what you're trying to achieve?

So, are they running on the same server or not?

yes sir they both are on same server
Title: Re: One forums latest posts on another forum
Post by: yourdailysaver on December 11, 2009, 04:25:01 PM
i have read the ssi.php introduction. have some confusions. where do i need to put <?php require("/path/to/forum/SSI.php"); ?>  and after that how can i use <?php ssi_recentPosts(); ?>  function in my another forum ? dont i need to give some path in it ?
Title: Re: One forums latest posts on another forum
Post by: shumilica on December 11, 2009, 04:33:53 PM
i don't know how ezportal works , but try creating a block, pick php block (so that you can enter php code) and in that block enter:
ssi_recentPosts();

if it doesn't work go to your forum directory, open index.php the comments put there:
require("SSI.php");
Title: Re: One forums latest posts on another forum
Post by: yourdailysaver on December 11, 2009, 04:36:35 PM
if i put ssi_recent posts() function in my forum B how can posts from forum A will be fetched. there must be some connection between them
Title: Re: One forums latest posts on another forum
Post by: Arantor on December 11, 2009, 04:38:10 PM
When you require SSI.php, you have to use the path to the other forum's files.

So if forum A is the one with the portal in /home/user_a/public_html and forum B is the other content in /home/user_b/public_html, you have to use require('/home/user_b/public_html/SSI.php'); first to load the details of the other forum.
Title: Re: One forums latest posts on another forum
Post by: yourdailysaver on December 11, 2009, 04:40:23 PM
Quote from: Arantor on December 11, 2009, 04:38:10 PM
When you require SSI.php, you have to use the path to the other forum's files.

So if forum A is the one with the portal in /home/user_a/public_html and forum B is the other content in /home/user_b/public_html, you have to use require('/home/user_b/public_html/SSI.php'); first to load the details of the other forum.

sorry brother i am not very tech savvy can you please explain me step by step if possible ?
Title: Re: One forums latest posts on another forum
Post by: Arantor on December 11, 2009, 04:43:41 PM
Not really without knowing more details, like the full paths of both forums.
Title: Re: One forums latest posts on another forum
Post by: Arantor on December 11, 2009, 04:49:58 PM
Please remove those links. They are not suitable for the family friendly site we are.

I need to know the FULL physical paths, not the domains, nor the subpaths. You may need to ask your host for the full physical path.
Title: Re: One forums latest posts on another forum
Post by: shumilica on December 11, 2009, 05:08:50 PM
Or better than asking the hoster go to your forums - admin - configuration - server settings - database and paths and copy paste the 'smf directory' field. Now go to the other forum and do the same. Paste it here, or put it yourself in the:
require("/path/to/forum/SSI.php"); (change path to forum with the forum you want to get recent posts, and put it in the index of the forum you want to show the recent posts from the other forum).
Title: Re: One forums latest posts on another forum
Post by: yourdailysaver on December 12, 2009, 12:18:14 AM
Thanks shumilica for info on how to get paths

The forum where i want to get recent posts from another forum has following paths,
         
SMF Directory    /homepages/9/d269191381/htdocs/bf
Sources Directory  /homepages/9/d269191381/htdocs/bf/Sources
Cache Directory    /homepages/9/d269191381/htdocs/bf/cache

and the forum from which i want to get latest posts has paths as follows,

SMF Directory          /homepages/9/d269191381/htdocs/ForumBollychilli
Sources Directory    /homepages/9/d269191381/htdocs/ForumBollychilli/Sources
Cache Directory      /homepages/9/d269191381/htdocs/ForumBollychilli/cache

And can you please explain from where i should download ssi.php file and what to do with that ? i am not yet sure what exactly i need to do. Please sir if you can guide me step by step it will be really great help to me
Title: Re: One forums latest posts on another forum
Post by: yourdailysaver on December 12, 2009, 01:28:07 AM
it displays following error when i added that code to forums index file,

Fatal error: Cannot redeclare cleanrequest() (previously declared in /homepages/9/d269191381/htdocs/ForumBollychilli/Sources/QueryString.php:95) in /homepages/9/d269191381/htdocs/bf/Sources/QueryString.php on line 93
Title: Re: One forums latest posts on another forum
Post by: Arantor on December 12, 2009, 03:16:28 AM
SSI.php is part of your forum.

So, in the portal block for bf forum, you add something like:
<?php require('/homepages/9/d269191381/htdocs/ForumBollychilli/SSI.php');
ssi_recentPosts(); ?>


Then it might work. No guarantee of at all that however.
Title: Re: One forums latest posts on another forum
Post by: yourdailysaver on December 12, 2009, 03:23:29 AM
Quote from: Arantor on December 12, 2009, 03:16:28 AM
SSI.php is part of your forum.

So, in the portal block for bf forum, you add something like:
<?php require('/homepages/9/d269191381/htdocs/ForumBollychilli/SSI.php');
ssi_recentPosts(); ?>


Then it might work. No guarantee of at all that however.

it displays following in php block after doing that,

ezBlock unable to run PHP syntax error!

dont i need to put something in any index.php ? i dont know which index.php the one in themes default, the one in theme i am using or the one in root folder
Title: Re: One forums latest posts on another forum
Post by: Arantor on December 12, 2009, 03:27:40 AM
No, it's definitely a portal block you will need to change, nothing whatsoever to do with index.php.

Though this makes life more complex, we now get into the fun and games of using iframes :S

You need to create a new file in /homepages/9/d269191381/htdocs/ForumBollychilli/ called recentposts.php and have it contain the above code. Then you can browse to it from www.forumbollychilli.com/recentposts.php, to check it works.

Then you add an iframe to the portal block to show that on the other forum (please do a search for this, it's been covered countless times here, not to mention on numerous other sites)
Title: Re: One forums latest posts on another forum
Post by: yourdailysaver on December 12, 2009, 03:36:14 AM
check at www.forum.bollychilli.com/recentposts.php i can see posts there now can you please me what to do to see it in my another forums block ?
Title: Re: One forums latest posts on another forum
Post by: Arantor on December 12, 2009, 04:08:00 AM
Well, apart from the page being incorrect, due to which I assume is a space in front of the <?php in the file (has a nice big error on it)

You need to add an <iframe> tag into the portal block. As I said this has been covered many times, so a quick forum search should show you plenty of examples of how to do it.
Title: Re: One forums latest posts on another forum
Post by: yourdailysaver on December 12, 2009, 05:22:00 AM
i am able to see posts from forum b to my forum a's portal now. thanks buddy but the issue is its really  bad in appearance. how can i make it match to my forum a's theme >?
Title: Re: One forums latest posts on another forum
Post by: yourdailysaver on December 12, 2009, 05:36:40 AM
Quote from: Arantor on December 12, 2009, 04:08:00 AM
Well, apart from the page being incorrect, due to which I assume is a space in front of the <?php in the file (has a nice big error on it)

You need to add an <iframe> tag into the portal block. As I said this has been covered many times, so a quick forum search should show you plenty of examples of how to do it.

hey bro. thanks for all your help but that error message is still there.
Title: Re: One forums latest posts on another forum
Post by: Arantor on December 12, 2009, 05:36:58 AM
So can you attach the file you created here so I can take a look at it then please?
Title: Re: One forums latest posts on another forum
Post by: yourdailysaver on December 12, 2009, 03:34:58 PM
here it is
Title: Re: One forums latest posts on another forum
Post by: Arantor on December 12, 2009, 03:38:36 PM
Your file is:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<?php require('/homepages/9/d269191381/htdocs/ForumBollychilli/SSI.php');
ssi_recentTopics();?>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>

<body>
</body>
</html>


That is the problem.

As I posted, it should contain ONLY what I posted:
<?php require('/homepages/9/d269191381/htdocs/ForumBollychilli/SSI.php');
ssi_recentTopics();?>


Or if you insist on it having an HTML wrapper:
<?php require('/homepages/9/d269191381/htdocs/ForumBollychilli/SSI.php'); ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<?php ssi_recentTopics();?>
</body>
</html>
Title: Re: One forums latest posts on another forum
Post by: yourdailysaver on December 12, 2009, 03:45:52 PM
thanks bro. that is fine now. but when i add it to my forum A using frame tag it looks really worst than ever. isnt there any other way . means i have recent posts block on forum A which displays forum A's recent posts. It might be also using the ssi.php from forum A. And if so than is there a possiblity to change path to forum B's ssi.php ?
Title: Re: One forums latest posts on another forum
Post by: Arantor on December 12, 2009, 04:21:09 PM
There isn't any other way without doing LOTS of manual coding which I don't have the time to sit and write for you.

You know, you can actually customise its style with a little work. Less work than writing the alternative.

Thing is, you never actually said how you wanted it to look.
Title: Re: One forums latest posts on another forum
Post by: yourdailysaver on December 12, 2009, 04:23:28 PM
i wanted it to match my Forum A's block look i am using curve theme. please let me know how to customise its style ?
Title: Re: One forums latest posts on another forum
Post by: Arantor on December 12, 2009, 04:23:57 PM
Considering I have NO IDEA what that forum looks like, how can I customise it?
Title: Re: One forums latest posts on another forum
Post by: yourdailysaver on December 12, 2009, 04:26:57 PM
sent you link by pm as its not family friendly forum
Title: Re: One forums latest posts on another forum
Post by: Arantor on December 12, 2009, 04:28:24 PM
I would point out that I normally delete unsolicited PMs, it is more polite to ask first. However given that there is no way around this, it's fine in this case only.
Title: Re: One forums latest posts on another forum
Post by: yourdailysaver on December 12, 2009, 04:30:11 PM
sorry buddy but replied to your pm again. i want it to look like recent posts block on forum A
Title: Re: One forums latest posts on another forum
Post by: yourdailysaver on December 12, 2009, 04:31:54 PM
if you can visit forum A now you can see how that block looks like
Title: Re: One forums latest posts on another forum
Post by: yourdailysaver on December 12, 2009, 04:35:26 PM
background and title color are good but no need for topic name "Actresses" and date and time field and also if possible only need 5 recent topics
Title: Re: One forums latest posts on another forum
Post by: yourdailysaver on December 12, 2009, 04:38:41 PM
and sorry sir but one more issue when i am clicking on recent posts it opens in same small window . is it possible to make them links which opens in new browser window ?
Title: Re: One forums latest posts on another forum
Post by: Arantor on December 12, 2009, 04:40:52 PM
So how exactly does it look then?

BEFORE I go any further, please PM me with a link to actually show me the block you've added because right now I'm trying to figure out how to make something look different without seeing the code you have now.
Title: Re: One forums latest posts on another forum
Post by: yourdailysaver on December 12, 2009, 04:43:37 PM
pm sent
Title: Re: One forums latest posts on another forum
Post by: Arantor on December 12, 2009, 05:08:45 PM
This might help.

<?php require('/homepages/9/d269191381/htdocs/ForumBollychilli/SSI.php'); ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" type="text/css" href="/Themes/default/css/index.css?rc2" />
<title>Untitled Document</title>
</head>
<body>
<?php $posts ssi_recentTopics(8nullnull'array');
echo '
<table border="0" class="ssi_table">'
;
foreach ($posts as $post)
echo '
<tr>
<td align="right" valign="top" nowrap="nowrap">
['
$post['board']['link'], ']
</td>
<td valign="top">
<a target="_blank" href="'
$post['href'], '">'$post['subject'], '</a>
'
$txt['by'], ' '$post['poster']['link'], '
'
, !$post['is_new'] ? '' '<a href="' $scripturl '?topic=' $post['topic'] . '.msg' $post['new_from'] . ';topicseen#new" rel="nofollow"><img src="' $settings['lang_images_url'] . '/new.gif" alt="' $txt['new'] . '" border="0" /></a>''
</td>
<td align="right" nowrap="nowrap">
'
$post['time'], '
</td>
</tr>'
;
echo '
</table>'
;
?>

</body>
</html>


This should load the main style code for Curve (the theme in use), then lay it out using the rules therein, plus load it in a new tab as opposed to the frame.
Title: Re: One forums latest posts on another forum
Post by: yourdailysaver on December 12, 2009, 05:12:33 PM
where do i need to add this code sir ? in recenttopics.php file ?
Title: Re: One forums latest posts on another forum
Post by: Arantor on December 12, 2009, 05:15:50 PM
Yes. In place of the code you had before.
Title: Re: One forums latest posts on another forum
Post by: yourdailysaver on December 12, 2009, 05:20:54 PM
Quote from: Arantor on December 12, 2009, 05:15:50 PM
Yes. In place of the code you had before.

yes sir the click problem is solved it opens in new window now. but the background was better before and how to remove board name, date & time and posted by from the list. and it shows large blank space after topic list you can check it at the same link. i have activated the block now.
Title: Re: One forums latest posts on another forum
Post by: Arantor on December 12, 2009, 05:25:05 PM
<?php require('/homepages/9/d269191381/htdocs/ForumBollychilli/SSI.php'); ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" type="text/css" href="/Themes/default/css/index.css?rc2" />
<title>Untitled Document</title>
</head>
<body style="background:#F0F4F7;">
<?php $posts ssi_recentTopics(8nullnull'array');
echo '
<table border="0" class="ssi_table">
<tr>
<td>'
;
foreach ($posts as $post)
echo '
<a target="_blank" href="'
$post['href'], '">'$post['subject'], '</a>
'
$txt['by'], ' '$post['poster']['link'], '
'
, !$post['is_new'] ? '' '<a href="' $scripturl '?topic=' $post['topic'] . '.msg' $post['new_from'] . ';topicseen#new" rel="nofollow"><img src="' $settings['lang_images_url'] . '/new.gif" alt="' $txt['new'] . '" border="0" /></a>''
<br />
'
$post['time'], '
<hr />'
;

echo '
</td>
</tr>
</table>'
;
?>

</body>
</html>
Title: Re: One forums latest posts on another forum
Post by: yourdailysaver on December 12, 2009, 05:27:03 PM
thanks a lot sir i really appreciate your efforts . i can't believe its done . i have enabled block now you can see that .
Title: Re: One forums latest posts on another forum
Post by: Arantor on December 12, 2009, 05:30:15 PM
Good to see it's working. You can shorten it by shortening the height in the iframe.

There was a minor typo in the code - the last <td> should have been </td> - I've fixed the above though.
Title: Re: One forums latest posts on another forum
Post by: yourdailysaver on December 12, 2009, 05:34:21 PM
thanks a lot sir i have shortened it also . just last request if its possible to bold those fonts as it looks little thinner than recent posts block
Title: Re: One forums latest posts on another forum
Post by: Arantor on December 12, 2009, 05:37:22 PM
<?php require('/homepages/9/d269191381/htdocs/ForumBollychilli/SSI.php'); ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" type="text/css" href="/Themes/default/css/index.css?rc2" />
<title>Untitled Document</title>
</head>
<body style="background:#F0F4F7;">
<?php $posts ssi_recentTopics(8nullnull'array');
echo '
<table border="0" class="ssi_table">
<tr>
<td>'
;
foreach ($posts as $post)
echo '
<span class="smalltext">
<strong><a target="_blank" href="'
$post['href'], '">'$post['subject'], '</a></strong>
'
$txt['by'], ' '$post['poster']['link'], '
'
, !$post['is_new'] ? '' '<a href="' $scripturl '?topic=' $post['topic'] . '.msg' $post['new_from'] . ';topicseen#new" rel="nofollow"><img src="' $settings['lang_images_url'] . '/new.gif" alt="' $txt['new'] . '" border="0" /></a>''
<br />
'
$post['time'], '</span>
<hr />'
;

echo '
</td>
</tr>
</table>'
;
?>

</body>
</html>
Title: Re: One forums latest posts on another forum
Post by: yourdailysaver on December 13, 2009, 12:28:33 AM
great sir you are a genious. thanks a lot once again