Integrate ssi functions from smf forum

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
hdiaz36
Regular
Posts: 57
Joined: Wed Feb 21, 2007 6:57 pm
Location: China (Yes, really)

Integrate ssi functions from smf forum

Post by hdiaz36 »

I asked a similar question previously, but abandoned the issue as it wasn't all that important to me at the time.

I am trying to show the recent posts and/or topics from my Simple Machines forum (SMF) on my blog.

According to the guys at SMF the way to achieve this is using SSI.php
I've been looking over the information such as --> http://docs.simplemachines.org/index.php?topic=400.0

Problem is that I have no idea where to paste this code in Serendipity.

So for example where would I paste

Code: Select all

<?php require("/path/to/forum/SSI.php"); ?>
(supposedly should be placed before <html> tag, so at the very top of the page... haha, but which page, sure beats me)

and

Code: Select all

<?php ssi_recentTopics(); ?>
Thank you in advance for any assistance with this. Oh, if more information is required I'll be happy to provide it.
Image
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Integrate ssi functions from smf forum

Post by Timbalu »

Hi

Try and use the serendipity_event_wrapurl plugin. There you can easily point to your own php file which gets build into s9y via an iframe like a static page.

Ian
hdiaz36
Regular
Posts: 57
Joined: Wed Feb 21, 2007 6:57 pm
Location: China (Yes, really)

Re: Integrate ssi functions from smf forum

Post by hdiaz36 »

Hmm, ok, I guess I really need some sleep, because I can't seem to figure this stuff out.

I'll probably be back with some questions later, but one thing I want to ask before I sleep is how do I control the positioning of the iframe?

Thanks so much for you help.
Image
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Integrate ssi functions from smf forum

Post by Timbalu »

Hi

wrapurl plugin
The headline [my Forum:] (above iframe)
Your Staticpage like Permalink [/path/to/serendipity/forum/includeforum.html] (this one is the link to your forum your are pointing to in your navbar)
URL shorthand name [includeforum]
The URL [/path/to/serendipity/forum/includeforum.php]
Append GET-Variables [try yes]
Hide sidebars? [serendipity sidebar yes or no]

In includeforum.php you do the require or include and all other php and html stuff you need, to get you forum started and running. eg

Code: Select all

<html>
<body>
<?php 
      require("/path/to/forum/SSI.php");
      echo 'Intro something';
      ssi_recentTopics();
?>
</body>
</html>
The position of the iframe inside serendipity is {CONTENT} (like all other blog entries), as far as I remember. You have to give it a height inside the plugins config where scrollbars beginn. There is no other control than using the plugins config or CSS eg #plugin_wrapurl_includeforum { width:300px;border:2px solid #777; etc } to markup the iframe. Inside your includeforum.php you can include your own stylesheet and html tags etc.

hth,
Ian
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Integrate ssi functions from smf forum

Post by garvinhicking »

Hi!

And if you would really need to enter PHP code somewhere, you could use the "serendipity_event_externalphp" plugin (spartacus.s9y.org) to include any local PHP files...

HTH,
GArvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
hdiaz36
Regular
Posts: 57
Joined: Wed Feb 21, 2007 6:57 pm
Location: China (Yes, really)

Re: Integrate ssi functions from smf forum

Post by hdiaz36 »

Bear with me please.

I'm not getting this to work and I believe it has something to do with the paths...

Let's say my blog is installed in a subdirectory, so www.mywebsite.com/blog
My forum is installed in another sub-directory, so www.mywebsite/com/forum

Does it matter where I place the php file? Currently it is in the forum sub-directory.

With my above example what are the paths I would enter for the permalink etc.

Do I need to create two files (one html and one php), or...?

I have quite limited experience with coding, so this is all so foreign to me...
Image
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Integrate ssi functions from smf forum

Post by Timbalu »

Hi
What I would do, without knowing the specialities of SMF, create a file and name it 'incforum.php'.
This file I would store in a folder /forum/ underneath /blog/, just to make sure. Inside this file you put your <?php require("/forum/SSI.php"); and so on.
(Pointing a file to / is commonly the domains root, if so, you can include different folders easily.)

If this is not working, your incforum.php has to be in the DOC_ROOT like http://www.mywebsite.com/incforum.php and you can use require(dirname(__FILE__) . '/forum/SSI.php'); ... inside the fiile to include SSI.php with the full Server path.

In the WrapUrl plugin use Permalink to point to a virtual html file like [/blog/pages/forum.html]. This is your inside navigation url for the forum. No need to create it in real life.
In plugins URL you write [/blog/forum/incforum.php].
If you now call http://www.yourblog/pages/forum.html the php file and your SMF get executed in an iframe, which might be better to handle than "serendipity_event_externalphp" plugin.


Give it a try.
Ian
hdiaz36
Regular
Posts: 57
Joined: Wed Feb 21, 2007 6:57 pm
Location: China (Yes, really)

Re: Integrate ssi functions from smf forum

Post by hdiaz36 »

Thanks so much for trying to assist me.

Question: why do you have the "pages" in
Timbalu wrote: In the WrapUrl plugin use Permalink to point to a virtual html file like [/blog/pages/forum.html].
Also, you're saying to create a new folder in my blog's sub-directory, is that right?

Strangely the more time I spend on this, the more confused I seem to be getting.
Image
hdiaz36
Regular
Posts: 57
Joined: Wed Feb 21, 2007 6:57 pm
Location: China (Yes, really)

Re: Integrate ssi functions from smf forum

Post by hdiaz36 »

Yeah, I'm not sure how much more time I can devote to this.

Is there anyone who thinks they can accomplish this for me?
Image
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Integrate ssi functions from smf forum

Post by Timbalu »

Hi
Did you try it? What happend?

1. You don't really need the /pages/ part. Its just to sign them as virtual files.

2. Yes, try to create that folder /blog/forum and put the code part from my second posting into it and name it incforum.php (ajust the /path/to/forum/ part to your SSI.php path needs). If you are not able to create a new folder put it in the DOC_ROOT and ajust the path setting.

3. Do the WrapUrl config as adviced and have a try. Don't get confused, there is not much to break with this.

4. If the forum does not happen under the virtual link, there is something wrong with the require path. If you know your full server path eg. /var/www/web19/html/forum or similar, write the full path inside the require part of the code part to call SSI.php. You can find the full path settings in Serendipity / Adminpanel / Configuration / Path / Full Path.

5. Report what happens, here. We'll get you there! :D

Good luck,
Ian
hdiaz36
Regular
Posts: 57
Joined: Wed Feb 21, 2007 6:57 pm
Location: China (Yes, really)

Re: Integrate ssi functions from smf forum

Post by hdiaz36 »

I'm not really sure that I understand this plugin.

I cannot seem to get it to work with any files or with any urls. Can this plugin be used to point to external websites, for example http://www.google.com ?

Haha, what I am doing wrong, I really don't know. This is an event plugin, right?

I tried starting over from scratch so I removed the plugin and reinstalled it.
Here is what I originally see:

Headline -->
Permalink--> /blog/index.php?/wpages/pagetitle.html
URL shorthand name (Backwards compatibility) --> pagetitle
The URL --->
Height in Pixels --> 1000
Append GET-Variables --> no
Hide sidebars? --> no

I believe that the path to my blog is as follows --> /home/daxueyin/public_html/blog/
This path is what I get when I go to administration -- configuration -- paths

I don't even see a link to anything on my blog when I enter something in the headline field. That tells me that there must be something I am not doing correctly.

I seriously appreciate all the help so far. Can you offer some more guidance, let me get this working with some other website first and then I'll double back and attempt to get my php file working... assuming this plugin is meant to work with external websites.
Image
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Integrate ssi functions from smf forum

Post by Timbalu »

hdiaz36 wrote:I'm not really sure that I understand this plugin.

I cannot seem to get it to work with any files or with any urls. Can this plugin be used to point to external websites, for example http://www.google.com ?
Usually an iframe is able to do this, but the plugin is meant to include files or frameworks on the same server. Are you sure you are allowed to reach google.com in China?
hdiaz36 wrote:Haha, what I am doing wrong, I really don't know. This is an event plugin, right?
Yes!
hdiaz36 wrote:I tried starting over from scratch so I removed the plugin and reinstalled it.
Here is what I originally see:

Headline -->
Permalink--> /blog/index.php?/wpages/pagetitle.html
URL shorthand name (Backwards compatibility) --> pagetitle
The URL --->
Height in Pixels --> 1000
Append GET-Variables --> no
Hide sidebars? --> no

I believe that the path to my blog is as follows --> /home/daxueyin/public_html/blog/
This path is what I get when I go to administration -- configuration -- paths
Thats good! Now we do

Code: Select all

Headline  -->
Permalink--> /blog/index.php?/myforum.html
URL shorthand name (Backwards compatibility) --> myforum
The URL ---> /blog/forum/incforum.php
Height in Pixels --> 1000
Append GET-Variables --> YES
Hide sidebars? --> no
and inside incforum.php we write

Code: Select all

<html>
<head>myForum</head>
<body>
<?php
      require("/home/daxueyin/public_html/forum/SSI.php");

      echo '<p>Welcome! This is my Forum inside Serendipity Blog.
              Please read the recent topics:</p>
              <hr />';

      ssi_recentTopics();
?>
</body>
</html>
Thats all we need to do so far.
hdiaz36 wrote:I don't even see a link to anything on my blog when I enter something in the headline field. That tells me that there must be something I am not doing correctly.

I seriously appreciate all the help so far. Can you offer some more guidance, let me get this working with some other website first and then I'll double back and attempt to get my php file working... assuming this plugin is meant to work with external websites.
Yes, sure! I dont recommend using some other site first. Lets do it with your forum. Since we know that you do not have mode_rewrite enabled, which is a webserver feature to modify odd looking urls like /blog/index.php?/myforum.html to pretty ones like /blog/myforum.html, we can get this to work. Sorry, it was my fault, not to ask about this first!

Now you have to tell your Blog, that there is a new page you want do have displayed as a new link somewhere in the navigation bar or in the sidebars. This is not done automaticly! Assuming we want it in the sidebar, we could install a sidebar nugget and go into Admin Panel / Plugins / new Sidebar Plugin / install the serendipity_html_nugget_plugin and write in its config:

Code: Select all

1: ---> My Forum
2: ---> blah blah something
Entry: ---> <p class="aligncenter"><a href="/blog/index.php?/myforum.html">my forum</a></p>
4: ---> YES
5: ---> Everywhere
With ok and going back to blog, you should now see this link in a new section of your sidebar. If not, there is something wrong, which we can find out next time, but you could clear first, if the url http://www.yourDomain.cn/blog/index.php?/myforum.html is working as expected, when you put it manually in your browsers addressbar.

Are there errors? How does it look like?

good luck
Ian

Edit:
Just doing some testing. Does the url http://www.yourDomain.cn/forum/incforum.php work? What kind of output? Any differs from http://www.yourDomain.cn/forum/index.php etc. ?
hdiaz36
Regular
Posts: 57
Joined: Wed Feb 21, 2007 6:57 pm
Location: China (Yes, really)

Re: Integrate ssi functions from smf forum

Post by hdiaz36 »

Ok, I followed your instructions to the T.

I managed to get the link in the sidebar working just fine. I also got it working on the page with HTML Nugget on Page plugin. However, this doesn't quite do what I had in mind. It only provides a link to the recent topics from the forum. What I originally set out to do was to get the topics displayed on every page of my blog, and not just a link to them displayed on my blog. Haha, it's quite possible that I didn't specify this in my earlier posts.

I am glad to have finally seen some results. Thanks once again!
Image
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Integrate ssi functions from smf forum

Post by Timbalu »

hdiaz36 wrote:However, this doesn't quite do what I had in mind. It only provides a link to the recent topics from the forum. What I originally set out to do was to get the topics displayed on every page of my blog, and not just a link to them displayed on my blog. Haha, it's quite possible that I didn't specify this in my earlier posts.
Truly! :wink: Glad we got it working, though!
Does the url /blog/index.php?/myforum.html show the topics as you want them to be in your blogs sidebar to be viewable everywhere?
If this is the way you want it to be, we might find a better way to display the topics in the sidebar via a very own plugin.

Ian
hdiaz36
Regular
Posts: 57
Joined: Wed Feb 21, 2007 6:57 pm
Location: China (Yes, really)

Re: Integrate ssi functions from smf forum

Post by hdiaz36 »

Timbalu wrote: Does the url /blog/index.php?/myforum.html show the topics as you want them to be in your blogs sidebar to be viewable everywhere?
If this is the way you want it to be, we might find a better way to display the topics in the sidebar via a very own plugin.

Ian
Yes, the url /blog/index.php?/myforum.html shows the topics exactly as I would like them to be displayed... just that they are on another page whereas I'd like them to be displayed at the bottom of every page.

Two things I should say are that I do not want to display anything in the sidebar as there isn't enough space there. Also, I would like the topics to be displayed on the bottom of every page, or for the very least the top directory of the blog. If there is only a "link" to the most recent forum topics it doesn't quite have the effect that I was going for.

This might seem like a silly question since I don't know much about coding and the inner workings of both SMF and Serendipity. However, if I could somehow place the code

Code: Select all

<?php require("/home/daxueyin/public_html/forum/SSI.php"); ?>
at the very top of whatever index file is used to generate the blog, then wouldn't I be able to use the "HTML Nugget on page" plugin to paste the code

Code: Select all

<?php ssi_recentTopics(); ?>
at the bottom of every page easily?

I really want like the last 8 or 10 forum posts to be visible on the blog's homepage without the user having to click anything or take any further action.
Image
Post Reply