Custom page outside forum's directory

Started by Hristo, January 26, 2013, 03:51:57 PM

Previous topic - Next topic

Hristo

I would like to use a custom home page outside forum's directory and I really do not like to use a whole portal for that purpose. This code http://www.simplemachines.org/community/index.php?topic=412852.msg2879370#msg2879370 did the job. Unfortunately one of the mods I would like to use http://custom.simplemachines.org/mods/index.php?mod=1584 triggers some warning messages visible on the page (I do not think it's mod's fault, so I post here). Here you can see the problem:
http://bg-gradina.org/test.php

Is there a way to hide these warning messages without changing any forum files?

If that will help, here are the Subs.php lines 3332 - 3353:

// Print stuff to prevent caching of pages (except on attachment errors, etc.)
if (empty($context['no_last_modified']))
{
3335 header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
3336 header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');

// Are we debugging the template/html content?
if (!isset($_REQUEST['xml']) && isset($_GET['debug']) && !$context['browser']['is_ie'] && !WIRELESS)
header('Content-Type: application/xhtml+xml');
elseif (!isset($_REQUEST['xml']) && !WIRELESS)
3342 header('Content-Type: text/html; charset=' . (empty($context['character_set']) ? 'ISO-8859-1' : $context['character_set']));
}

3345 header('Content-Type: text/' . (isset($_REQUEST['xml']) ? 'xml' : 'html') . '; charset=' . (empty($context['character_set']) ? 'ISO-8859-1' : $context['character_set']));

$checked_securityFiles = false;
$showed_banned = false;
foreach ($context['template_layers'] as $layer)
{
loadSubTemplate($layer . '_above', true);

// May seem contrived, but this is done in case the body and main layer aren't there...


Kindred

you are obviously using the wrong code to generate your custom page.

Please post your actual page code here and we'll give you a better way to do it so that the SSI and headers are properly called.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Hristo

I have not changed the original code except the directory of course. Here it is:

<?php
//Set the banning active
$ssi_ban = true;

//Path to SSI.php
require("test/SSI.php");

//Page title. This will appear in the browser
$context['page_title_html_safe'] = 'Page title';

//This is self explanatory
template_header();

//Here we define the link tree
$context['linktree'] = array(
 
'href' => $scripturl,
 );
 
//Here is the content, such as the title and the body message of the custom page.

echo'
<span class="clear upperframe"><span></span></span>
<div class="roundframe"><div class="innerframe">'
;
echo'
<div class="cat_bar">
<h3 class="catbg">Hello everyone</h3>
</div>
   <p>This is a custom page example. pretty cool, huh.</p>'
;
echo'
  </div></div>
 <span class="lowerframe"><span></span></span>'
;


//This is self explanatory too.  
template_footer();

?>


I tested it on another test forum with 80+ mods and only the above mentioned mod causes these warnings to appear.

Arantor

You might want to try using subdomain independent cookies, and I'd rather see the *file* test.php rather than its contents.

The error you're seeing on line 3335+ is specifically related to the notice raised by SSI.php line 170, which is potentially related to cookies and also a fault in the file.
Holder of controversial views, all of which my own.


Sorck

Quoteplease make sure SSI.php is included before *anything* else in all your scripts!
Looks to me like you're outputting some whitespace before your opening <?php tag in test.php (or you've echo'd something before requiring SSI.php).

Arantor

This is why I wanted to see the actual file ;)
Holder of controversial views, all of which my own.


Hristo

Enabled "Use subdomain independent cookies" - no change

Now I realize it was pure luck to pinpoint which mod causes the messages.

Do not waste your time with this. This was the best option, but I will use a workaround - html plus some SSI to achieve something close.

Here is the file if you are curious

Arantor

It was pure luck, because I'm certain it wasn't the mod in the first place - there is no reason that I can see why that mod would cause that issue (because if it was, *everything* would be broken, not just SSI), the error in question should affect more than just SSI.php...

But if you're not really interested in debugging further, fair enough.
Holder of controversial views, all of which my own.


Hristo

It should be the mod because when I uninstall it the warnings disappear. Seems odd problem, so I don't want to waste your time.

Arantor

And yet after skimming the mod's code I can't see why it should, and I also don't see why the mod author hasn't been notified so they can perhaps fix it... *shrug*
Holder of controversial views, all of which my own.


Hristo

OK, if you think it's a mod's bug, then I will report it.

Arantor

Holder of controversial views, all of which my own.


Hristo

Topic solved. I'm not familiar with php, but your comments helped me to find the problem. Thank you to both of you!
Here is where the problem was:
http://www.simplemachines.org/community/index.php?topic=284589.msg3478078#msg3478078

Advertisement: