Edited to save time:
Make backups of everything first. Now go to your efiction install and open up header.php
Just below the License text and above everything else, add:
// Theme we're going to use
$ssi_theme = 1;
// Layers we're going to use
$ssi_layers = array('main');
// Enable GZip compression (saves bandwidth)
$ssi_gzip = true;
Save and close the file. Remember that you can change which theme header to display by changing the number in the $ssi_theme = 1; part. 1 is the default theme.
Now go to your /smf/Themes/default/ directory and open index.template.php
Find:
global $context, $settings, $options, $scripturl, $txt, $modSettings;
Replace with:
global $context, $settings, $options, $scripturl, $txt, $titleinfo, $modSettings;
Find:
<title>', $context['page_title'], '</title>';
Replace with:
<title>', $titleinfo, $context['page_title'], '</title>';
Save and close the file.
Next, go to your smf install directory (/smf/) and open up SSI.php
Find:
// Load the current user's permissions....
loadPermissions();
Above that add:
// This is so that titles show as they should in efiction
if($current == "viewstory"){
if(isset($chapid)) {
$squery = dbquery("SELECT sid, inorder FROM ".TABLEPREFIX."fanfiction_chapters WHERE chapid = ".$chapid." LIMIT 1");
list($sid, $chapter) = dbrow($squery);
}
$titlequery = dbquery("SELECT story.title, story.coauthors, "._PENNAMEFIELD." as penname, story.summary FROM ".TABLEPREFIX."fanfiction_stories as story, "._AUTHORTABLE." WHERE sid = '$sid' AND "._UIDFIELD." = story.uid LIMIT 1");
if($story = dbassoc($titlequery)) {
$authlink[] = $story['penname'];
if($story['coauthors']) {
$coquery = dbquery("SELECT "._PENNAMEFIELD." as penname FROM "._AUTHORTABLE." WHERE FIND_IN_SET("._UIDFIELD.", '".$story['coauthors']."') > 0 ORDER BY "._PENNAMEFIELD);
while($co = dbassoc($coquery)) {
$authlink[] = $co['penname'];
}
}
$titleinfo = stripslashes($story['title'])." "._BY." ".implode(", ", $authlink);
$metaDesc = htmlspecialchars(stripslashes($story['summary']));
$filename = basename($titleinfo.".html");
$ie = eregi("msie", $_SERVER['HTTP_USER_AGENT']);
if ($ie) $filename = rawurlencode($filename);
header("Content-Disposition: inline; filename="".$titleinfo.""");
}
}
if($current == "viewuser" && isNumber($uid)) {
$author = dbquery("SELECT "._PENNAMEFIELD." as penname FROM "._AUTHORTABLE." WHERE "._UIDFIELD." = '".$uid."'");
list($penname) = dbrow($author);
$titleinfo = "$sitename :: $penname";
}
if(empty($titleinfo)) $titleinfo = "$sitename :: $slogan";
and that all there is to it. You can add a few other feature such a button link to your efic install by checking out this thread: https://efiction.org/forums/index.php?topic=5420.msg29371#msg29371
EDIT: Don't forget to add $titleinfo to the list of Globals in SSI.php and in index.template.php...
Everything below here is old:
I'm using this code to display the SMF forum header on my efic archive:
// Theme we're going to use
$ssi_theme = 1;
// Layers we're going to use
$ssi_layers = array('main');
// Enable GZip compression (saves bandwidth)
$ssi_gzip = true;
The problem is that when you use this, the efic archive stops displaying page titles. Does anyone here know what I'd have to do so that efiction still show the page title and story titles when using this?
I was thinking that if added $titleinfo somewhere in SMF, it would work, but I'm not too sure of where or even if that's what I need to do. Any ideas?
Okay, I got this to work for the site name and slogan, but not for the stories... In SSI.php I added this code:
if(!isset($titleinfo)) $titleinfo = "$sitename :: $slogan";
just above where it says:
// Load the current user's permissions....
And in index.template.php I changed this:
<title>', $context['page_title'], '</title>';
into this:
<title>', $titleinfo, $context['page_title'], '</title>';
and that seems to have done the trick. Using this, I just need to know what to add to get the story titles to show. If anyone could help me out a little, I'd really appreciate it.
EDIT: Don't forget to add $titleinfo to the list of Globals in SSI.php and in index.template.php...
You may want to change the subject of this thread so people know you're talking about an SMF bridge.
Done. Could you tell me what efiction uses to display the story titles as the page title when viewing a story? I thought that $titleinfo would cover it all, but it doesn't look like that is working for anything other than the site name and slogan...
It uses $titleinfo.
So if this code
if(!isset($titleinfo)) $titleinfo = "$sitename :: $slogan";
converts the site's name and slogan into $titleinfo, what do I need to convert the story titles into $titleinfo too? I've been looking, but I just can't find it...
The section directly above that should put it into $titleinfo. The sections where if($current == ...) is checked. I'm having a busy month but I'll try to look at it this weekend.
Very nice, Tammy! I've been trying to use sections of that without using the whole thing, and that was what had me messing up. In SSI.php just above the first mod above this, I added
if($current == "viewstory"){
if(isset($chapid)) {
$squery = dbquery("SELECT sid, inorder FROM ".TABLEPREFIX."fanfiction_chapters WHERE chapid = ".$chapid." LIMIT 1");
list($sid, $chapter) = dbrow($squery);
}
$titlequery = dbquery("SELECT story.title, story.coauthors, "._PENNAMEFIELD." as penname, story.summary FROM ".TABLEPREFIX."fanfiction_stories as story, "._AUTHORTABLE." WHERE sid = '$sid' AND "._UIDFIELD." = story.uid LIMIT 1");
if($story = dbassoc($titlequery)) {
$authlink[] = $story['penname'];
if($story['coauthors']) {
$coquery = dbquery("SELECT "._PENNAMEFIELD." as penname FROM "._AUTHORTABLE." WHERE FIND_IN_SET("._UIDFIELD.", '".$story['coauthors']."') > 0 ORDER BY "._PENNAMEFIELD);
while($co = dbassoc($coquery)) {
$authlink[] = $co['penname'];
}
}
$titleinfo = stripslashes($story['title'])." "._BY." ".implode(", ", $authlink);
$metaDesc = htmlspecialchars(stripslashes($story['summary']));
$filename = basename($titleinfo.".html");
$ie = eregi("msie", $_SERVER['HTTP_USER_AGENT']);
if ($ie) $filename = rawurlencode($filename);
header("Content-Disposition: inline; filename="".$titleinfo.""");
}
}
and now it's working perfectly. Thank you so much for helping me out with this! I would have been here forever otherwise.
Add the second section if($current == "viewuser" &&...) and it'll put the username in the header when you're looking at their profile page.
I saw that while in the middle of adding it to my main site and added it too. Thank you so much for all of this help, Tammy. You Rock!
Bumping
Hi, I'm currently using 1.1.8 of SMF. The following code breaks eFiction (it displays a blank white page)
// Layers we're going to use
$ssi_layers = array('main');
Also where are $current, $sitename, $slogan set? I'm getting undefined error messages on my home page unless I prefix the variables with @
Does anybody have any ideas how to make this mod work once again?
Update:
I just noticed that the following code breaks the Authors page:
// Enable GZip compression (saves bandwidth)
$ssi_gzip = true;
Try commenting out or removing the $ssi_gzip = true; and leaving the rest...
I tried that, but the second command still leaves a blank page when going onto my eFiction site.
I'll take a look at mine and see if there's anything different.