Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Integrating Vanilla into Normal Webpages

edited October 2008 in Vanilla 1.0 Help
Hey, I'm currently working on a site and I'm looking to add Vanilla into the pages, but so far all I've found is a way to get the login session to be active on the main site. I'm currently looking for areas that contain all the html formatting for everything, but so far I haven't found anything. So does anyone know where all the html formatting of everything happens? Currently I'm looking for the people.php pages (part with the person's profile info and the Wall add-on) My final goal is to have the main page have a news section which will have discussions I've marked with "BlogThis" add-on, Discussion page with the main part of Vanilla integrated into it, and a profile page which would have the same info as the People.php page. The main site's design though is a little to different to integrate into Vanilla, so I figured I would integrate Vanilla's aspects with the main site. But in order to do that I need to find the main files where formatting is done. And then also the pages with functions on it. (Like where is "$Page->FireEvents();" defined/what does it do?) If anyone could help, that would be great!


  • RaizeRaize vancouver ✭✭
    edited October 2008
    There has been posts about this before, look a little deeper...but if I would help you I could :)
  • HTML stuff is in the themes folder. Like head.php, menu.php, foot.php are the containers, then more specific stuff is like discussions.php, discussion.php, etc.
  • Hmmm...Vanilla isn't even close to being an easy system to integrate with a pre-existing site lol. I could probably get it to an extent, but I wouldn't be able to have all the ajax functionality that comes with it... Anyone know someone who would be willing to integrate a site design and Vanilla?
  • I don't see what it is you are having problems with. Could you explain what you are trying to do in more detail, with links to your existing website? If you just want to have a forum section for your website it is very easy to wrap Vanilla in your website's design.
  • Well I'm trying to do a couple things. I have a page right now called profile.php outside the Vanilla directory. Its a completely different layout from the account.php layout used as Vanilla's account profile. I'd like to be able to have an account's info on that page, along with some add-ons I've got (Wall and 5 Latest Discussions). Then I also have the main page, which has some stuff on it and is also completely different from vanilla's page layout. However, on that page I would like to include all the discussions. So pretty much the "Discussions" tab content in Vanilla without the tabs (Pretty much JUST the part that shows the recent discussions). How do I do that?
  • SubJunkSubJunk ✭✭
    edited October 2008
    Well you can always just query the database from those pages separately. Just something like this:

    include_once('path/to/vanilla/appg/settings.php'); include_once('path/to/vanilla/conf/settings.php'); $sql="SELECT * FROM LUM_Discussion WHERE Active='1' AND Sink='0' ORDER BY DateLastActive DESC LIMIT 5"; $result = mysql_query($sql); while($row = mysql_fetch_array($result)) { $DiscussionID = $row['DiscussionID']; $Name = $row['Name']; $CountComments = $row['CountComments']; $PageWork = floor($CountComments / $Configuration['COMMENTS_PER_PAGE']); if ($PageWork > 0) { $Page = "&page=".$PageWork; } else { $Page = ""; } echo '<a href="/path/to/vanilla/comments.php?DiscussionID='.$DiscussionID.$Page.'">'.$Name.'</a><br />'; }That's just a quick idea anyway, I don't know how familiar you are with code. Let me know if it looks like nonsense.
  • I thought of doing that (That is how I got the username of people before I found out how to do it through Vanilla's objects), but part of vanilla that I like is all the javascript and ajax used throughout it. Just accessing the database separately will end up losing some of those features. The main discussion I can live with (Even though its nice not to have to load the page when posting), but the Wall add-on for example would lose half the fun-factor once it starts reloading the page.
  • SubJunkSubJunk ✭✭
    edited October 2008
    Well another option would be to use frames, so load the main forum page in an HTML frame on a page, then just make a get switch to deactivate certain parts of the page.
    So to hide the tabs and heading for example you would replace lines 25 to 35 of themes/menu.php with$inframe = $_GET['inframe']; if (empty($inframe)) { echo '<div id="Header"> <h1> '.$this->Context->Configuration['BANNER_TITLE'].' </h1> <ul>'; while (list($Key, $Tab) = each($this->Tabs)) { echo '<li'.$this->TabClass($this->CurrentTab, $Tab['Value']).'><a href="'.$Tab['Url'].'" '.$Tab['Attributes'].'>'.$Tab['Text'].'</a></li>'; } echo '</ul> </div>'; }
    so when you put the URL in the frame code just append inframe=yes to the end.
  • That could work, only problem though with that code you gave is that if inframe isn't set, it gives an undefined error. So I got rid of the variable and changed the if statement to: if (!isset($_GET['inframe'])) { Where is the side bar displayed? That part that shows the "Start a new discussion" link. Once I Get that, then I can try the iframe part and see how well that works out. I might also try a php include, I'd have to change the directory path though most likely, but that I'll find out once I get done formatting this main part (chdir will probably work).
  • Hmm....I just found the part that fills the menu and added another if statement so it only shows the content if inframe is empty, but that area is still there (just without anything in it). What creates that little area? (The shadow and the space to its left)
  • Hmm...Ok, so I think I got rid that sidebar thing, but I had to edit the style sheet. Can anyone think of a good way to switch between different style sheets based on something like the inframes? I looked at the header.php to see what selects the css files, and its just a simple while statement.
  • Maybe a better way to do it would be to leave the stylesheet as it was originally, then just display some extra CSS info if inframe is there. As long as you redefine the CSS at the bottom of the head section it will work. So you could change themes/head.php to this: <?php // Note: This file is included from the library/Framework/Framework.Control.Head.php class. $HeadString = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" ""> <html xmlns="" xml:lang="'.$this->Context->GetDefinition('XMLLang').'"> <head> <title>'.$this->Context->Configuration['APPLICATION_TITLE'].' - '.$this->Context->PageTitle.'</title> <link href="/favicon.ico" rel="shortcut icon" type="image/x-icon" />'; while (list($Name, $Content) = each($this->Meta)) { $HeadString .= ' <meta name="'.$Name.'" content="'.$Content.'" />'; } if (is_array($this->StyleSheets)) { while (list($Key, $StyleSheet) = each($this->StyleSheets)) { $HeadString .= ' <link rel="stylesheet" type="text/css" href="'.$StyleSheet['Sheet'].'"'.($StyleSheet['Media'] == ''?'':' media="'.$StyleSheet['Media'].'"').' />'; } } if (is_array($this->Scripts)) { $ScriptCount = count($this->Scripts); $i = 0; for ($i = 0; $i < $ScriptCount; $i++) { $HeadString .= ' <script type="text/javascript" src="'.$this->Scripts[$i].'"></script>'; } } if (is_array($this->Strings)) { $StringCount = count($this->Strings); $i = 0; for ($i = 0; $i < $StringCount; $i++) { $HeadString .= $this->Strings[$i]; } } $BodyId = ""; if ($this->BodyId != "") $BodyId = ' id="'.$this->BodyId.'"'; echo $HeadString; if (isset($_GET['inframe'])) { echo '<style type="text/css"> #Panel { display:none; } </style>'; } echo '</head> <body'.$BodyId.' '.$this->Context->BodyAttributes.'> <div id="SiteContainer">'; ?> for example
  • Hmm...I guess I could do that. Now I guess its just time to put it all together and see how it all looks :)
  • Good luck!
  • edited October 2008
    Thanks I just found something that is extremely useful! I can easily include things like the notices in pages by adding this to a page: chdir('vanilla'); include('appg/settings.php'); $Configuration['SELF_URL'] = 'message.php'; include('appg/init_vanilla.php'); $Page->AddRenderControl($NoticeCollector, $Configuration['CONTROL_POSITION_NOTICES']); $Page->FireEvents(); Never knew that. Guessing I can add the main discussion part by adding this: $Page->AddRenderControl($DiscussionGrid, $Configuration['CONTROL_POSITION_BODY_ITEM']); Might have to mess around with some templates, but I think it might work.
  • That's great, it looks like you are getting a good understanding of it now. Good job.
This discussion has been closed.