Firefox PHP

Place Phorum inside existing site body?

Posted by BryanB 
Place Phorum inside existing site body?
August 23, 2011 04:25PM
Hello,

I have tried to create a template that places my existing header (images, text, links, etc.) and top navigation (spry menu bar) at the head of the forums. To do this I created a new template (via copy) and modified the header.tpl file to use the php include functions as I did in my main site. However, this generated a lot of errors, I believe due to relative vs. absolute links.

Rather than doing this is there a way to just place the entire phorum inside the body of one of my existing pages?

PS. I searched this site for a long time before giving up and posting this new topic.

Bryan
Re: Place Phorum inside existing site body?
August 23, 2011 05:26PM
You cannot place Phorum directly in a page body. Reversely, you cannot dump any header script into header.tpl. The reason for both is that the header.tpl contains more than just plain header code. It also contains the references for things like javascript code, stylesheets, <head> tags and page redirects for Phorum. It's perfectly possible to make Phorum look like your main site, but make sure that you keep the important parts of the original header.tpl intact.

If you take a look at the original header.tpl, you will find those things that I references before. Keep them intact and you should be fine.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: Place Phorum inside existing site body?
August 23, 2011 05:56PM
What is the preferred method of making phorum look like the main site? Would all the contents of the "phorum" directory be on the main parent folder?

What I want to achieve is to have the logo, banner, and link navigation (via spry, jquery, javascript, etc.) appear at the top of every phorum page. Currently the site includes these required php files (css, php, etc).
Re: Place Phorum inside existing site body?
August 23, 2011 06:04PM
Another user listed their site: iCalamus that has similar functionality. I am not sure how this was achieved nor the best practice for achieving something like this within Phorum.
Re: Place Phorum inside existing site body?
August 24, 2011 03:04AM
The preferred method is to take the original header and footer templates and modify them to your needs. There will be some duplication of code, but this cannot really be prevented, since Phorum wants to push data to the HTML header too. Of course, it is perfectly possible to use PHP objects for generating layout elements from within the Phorum header.tpl. It is just that you cannot fully replace the header with any plain header file that you use for the main site.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: Place Phorum inside existing site body?
August 07, 2012 06:41PM
This topic has come up before. I once wondered if it would be possible to put the null string into the tpl files for the header, so <html.....body> would be empty and </body></html> would be empty. Then you could stuff what ever is left into a <div> ...phorum ... </div> inside any CMS.

Unfortunately Phorum does some conditional location redirecting that makes this difficult.
But it just occurred to me: it should be possible to use CURL to stuff all of phorum into a string variable. And then to use a regular expression to strip off the wrapping html and body tags. And then put that remaining string into a division.

I'll have to give that a try. Not sure if it would be prohibitively expensive. But it should be fairly straightforward to do.

====================



Edited 1 time(s). Last edit at 08/07/2012 06:43PM by salmobytes.
Re: Place Phorum inside existing site body?
August 08, 2012 01:52AM
I would just check how the embed_phorum module worked in 5.1 and do something similar ;)


Thomas Seifert
Re: Place Phorum inside existing site body?
December 08, 2012 06:07PM
If it is just for the looks, why not use the ancient frame methode? (bad for SEO, but if you don't care, it still works)
and remove unwanted html-layout from the phorum templates, always easier then adding functionality to it:)
Re: Place Phorum inside existing site body?
February 05, 2013 10:32PM
IFRAMES are no good because of SEO.
re-writing embed_phorum is a possibility.

I wonder about another take.
Let's say you have an existing CMS that can dynamically invoke any arbitrary "plugins/plugin.php" as the content generator for a <div id="whatever">

.......using a URL similar to:
http://localhost/?main-content=phorum&phorumParms=phorum/list.php?3

In other words the CMS invokes plugins/phorum.php to generate the HTML content for the division whose id is "main-content"

Further, the code for plugin.php is as follows:
<?php


class phorum extends plugin {

protected $parent;

/*
...inherited from plugin.php
function __construct() {

}

function setParent($parent) {
$this->parent = $parent;
}
*/
function getContent($parm = null) {
$phorumUrl = "[localhost]; . $_GET['phorumParms'];
$ret = file_get_contents($phorumUrl);

// now use preg_replace to strip off the html and body elements
$ret = preg_replace("/^(.*)\<body.*?\>|<\/body>.*$/","", str_replace("\n","",$ret));
return ($ret);
}

}

?>

....now all I have to do (it seems to me) is to hack the link generation inside the phorum codes so each phorum generated link looks like the bolded example above. Is there any reason that would not work?



Edited 2 time(s). Last edit at 02/05/2013 10:34PM by salmobytes.
Re: Place Phorum inside existing site body?
February 06, 2013 02:07AM
What about "POST" requests for posting messages?
What about header redirects and cookies?


Thomas Seifert
Sorry, only registered users may post in this forum.

Click here to login