SimplePortal

Support => English Support => Topic started by: MultiformeIngegno on September 02, 2009, 12:31:46 PM

Title: Blocks, advanced options
Post by: MultiformeIngegno on September 02, 2009, 12:31:46 PM
Hello!! :)
I've SimplePortal (2.3, works without a hitch!!) and other 4 php pages integrated with SSI.php.

I'd like to have a block in the portal, in the forum and in 3 of this 4 files, so excluding one of these.
I think I've to choose to show it "elsewere" and then exclude it in the one with some php code but... don't know how... can you help me?

Thanks in advance!! :D
Title: Re: Blocks, advanced options
Post by: MultiformeIngegno on September 02, 2009, 02:03:30 PM
The php files are integrated with this code, so I think I only need to add some lines to exclude the file from "elsewere":

Code: [Select]
require_once('../forum/SSI.php');
$context['tvpage'] = true;
$_GET['action'] = 'tv';
obExit(true);
function template_main()
{
   echo 'BLABLABLA';
}

:)
Title: Re: Blocks, advanced options
Post by: [SiNaN] on September 02, 2009, 03:51:16 PM
Hmmm... Can you provide a link to the pages you want to hide blocks for?
Title: Re: Blocks, advanced options
Post by: MultiformeIngegno on September 02, 2009, 05:14:48 PM
Hmmm... Can you provide a link to the pages you want to hide blocks for?
Of course, it's:
http://wiki.rockciclopedia.com

It's a MediaWiki implementation.... I want to hide blocks 'cause I can't fit 'em... there's not enough space... :P

And... let me take this chance to ask you something else, I'd like to have the proper button active (as you can see it's not the "wiki" one but the "forum" one...). I tried to specify a context for the page (as I do for other SSI.php integration). So I've added these lines ('wiki' is the name of the button is Subs.php):
$_GET['action'] = 'wiki';
$context['wikipage'] = true;

But... they seems to be no effect!!

These are the lines I used for the SSI.php integration, maybe are useful..
Code: [Select]
// Load up SSI
require_once('../forum/SSI.php');

// Load up the headers
template_header();

// Hit Counter
trackStats(array('hits' => '+')); trackStats();
Title: Re: Blocks, advanced options
Post by: [SiNaN] on September 02, 2009, 05:26:23 PM
Add $_GET['action'] = 'wiki'; before including SSI.php. Then use this custom display option for your block which you want to display on every page other than wiki:

Code: [Select]
all, -test
Title: Re: Blocks, advanced options
Post by: MultiformeIngegno on September 03, 2009, 05:55:21 AM
Add $_GET['action'] = 'wiki'; before including SSI.php.
I've already tried but nothing... :(
I think it doesn't work because I've only included the header ( template_header(); ), I've tried including the main_template();, but if I use this code:

<?php
/**
 * MonoBook nouveau
 *
 * Translated from gwicke's previous TAL template version to remove
 * dependency on PHPTAL.
 *
 * @todo document
 * @file
 * @ingroup Skins
 */
if( !defined( 'MEDIAWIKI' ) )
 die( -1 );



$_GET['action'] = 'wiki';
$context['wikipage'] = true;
require_once('../forum/SSI.php');
obExit(true);
function template_main()
{
echo '


/**
 * Inherit main code from SkinTemplate, set the CSS and template filter.
 * @todo document
 * @ingroup Skins
 */
class SkinMonoBook extends SkinTemplate {
 /** Using monobook. */
 function initPage( OutputPage $out ) {
  parent::initPage( $out );
  $this->skinname  = 'monobook';
  $this->stylename = 'monobook';
  $this->template  = 'MonoBookTemplate';
 }
 function setupSkinUserCss( OutputPage $out ) {
  global $wgHandheldStyle;
  parent

.........................

and at the and..:
 
';
}


I receive a plenty of syntax errors (example: $this->skinname  = 'monobook';, above). How can call the function template_main() without echoing all the php file?

Thanks!! :D

P.S.: For the other request (hiding blocks ...) I think that your code is fine ( but it works only if this above works, instead of -test I'll write -wiki!! ;) ).
Title: Re: Blocks, advanced options
Post by: [SiNaN] on September 03, 2009, 05:58:18 AM
Can you attach your file here? Setting $_GET action before including SSI.php would work no matter what.
Title: Re: Blocks, advanced options
Post by: MultiformeIngegno on September 03, 2009, 06:36:00 AM
Can you attach your file here? Setting $_GET action before including SSI.php would work no matter what.
Yes!!

In doubt I've attached also index.template.php (where you can see some conditions for "wikipage" that would work, for example a custom <title> ...), maybe is useful... ;)

EDIT:
I've noticed also another strange thing that could be related. In the other pages I've integrated with SSI.php I removed the linktree with this code:
Code: [Select]
   if (empty($context['linktree'][1]))
      $context['linktree'] = array();

...if I try to remove it also in this one (Monobook.php) it doesn't work!
But if I use the template_main() instead of only the header (but echoing only "abc", to avoid for testing the syntax errors), it works! And also other conditions I specified for "wikipage" context in index.template.php! So I think that the problem is that template_header! I need a way to use template_main without having syntax errors.... mmh... don't know.. :P
Title: Re: Blocks, advanced options
Post by: MultiformeIngegno on September 09, 2009, 01:53:07 PM
Please, help me!! :)

If I add only function template_main() without echoing all I receive the error:
Fatal error: Call to undefined function template_main() in /home/rock123/public_html/wiki/skins/MonoBook.php  on line 25
Title: Re: Blocks, advanced options
Post by: MultiformeIngegno on September 17, 2009, 05:04:34 PM
Sorry to bump it but I don't know how to do..... :(
Title: Re: Blocks, advanced options
Post by: Nathaniel on October 21, 2009, 04:47:24 AM
Sorry about the wait on this issue.

What custom display option code are you using? It should look something like this:
Code: [Select]
all, -~action|wiki
Buttons are edited in the Subs.php file for SMF 2, so I'll need that file to help with making your wiki button work properly.
Title: Re: Blocks, advanced options
Post by: MultiformeIngegno on November 11, 2009, 11:10:36 AM
Well... since I've done some edits and fixed some problems written here, let's forget previous posts, I'll explain the last problem I have now!

I've integrated MediaWiki (1.15.1: latest version available) and SMF (2.0 RC2) through SSI.php, after I've fixed some graphical issues, the problem I have now is that I'd like to have a custom "WIKI" button and have it active when users are in the wiki.

So I've created the button is Subs.php:
Code: [Select]
'wiki' => array(
'title' => 'Wiki',
'href' => 'http://wiki.rockciclopedia.com/index.php?title=Pagina_principale',
'show' => true,
'sub_buttons' => array(
),
),

Then I've searched at simplemachines.org how to make it active when users are in that page, so I added:
$_GET['action'] = 'wiki';

...to Monobook.php (the MediaWiki skin file, the one I've edited adding the SSI.php require string).

But it doesn't work! When I'm in the wiki the button active is still the "FORUM" one... and it's strange 'cause I've tried adding $_GET['action'] = 'something'; to another file that uses SSI.php and of course with another button created "ad hoc", for the test, and it works!
So, it seems to be that the $_GET['action'] = 'wiki' doesn't work only with MediaWiki...

I hope you can help me!! Anyway I've attached the 2 files I've edited:
Subs.php: for the button
MonoBook.php: the MediaWiki skin file, in it I've added the strings to integrate MW with SMF..
Title: Re: Blocks, advanced options
Post by: Nathaniel on November 11, 2009, 06:33:24 PM
The SSI.php file calls a function that trashes the $_GET array. Try the attached file.
Title: Re: Blocks, advanced options
Post by: MultiformeIngegno on November 12, 2009, 05:44:51 AM
The SSI.php file calls a function that trashes the $_GET array. Try the attached file.
YEAHHHHH!!! :D
Thanks Nathaniel!!!! It works!!!!!!

Now if you want my eternal veneration (:P) remains only one problem. I'm trying to specify another description for the wiki, so (as you can see in the MonoBook.php) I've added the line:
$context['wikipage'] = true;

Then in index.template.php I've done this:
if (!empty($context['wikipage']))
   echo 'My wiki description.';
else
   echo 'My forum description.';

echo '" />

...but in the wiki I still see the forum description... :(
Title: Re: Blocks, advanced options
Post by: Nathaniel on November 12, 2009, 05:52:12 AM
Make sure that you set the variables before the call to the 'template_header' function, also try adding "global $context;" before you set the variables.
Title: Re: Blocks, advanced options
Post by: MultiformeIngegno on November 12, 2009, 05:55:58 AM
Make sure that you set the variables before the call to the 'template_header' function, also try adding "global $context;" before you set the variables.
Yeah!!!!! It worked without the global $context;, simply moving it before the template_header!! :D

Is there a way to disable the automatically addition of the <title>sada</title> tags when using SSI.php..?
MediaWiki pages already have a <title>, so now I have 2 titles... :(
I need to remove the SMF one..
Title: Re: Blocks, advanced options
Post by: Nathaniel on November 12, 2009, 06:00:59 AM
Do a search for '<title>' in the index.template.php file for your theme, editing the code there should get you the result that you want.

End result (for the code that echos the SMF page title) could look like:
Code: [Select]
if (empty($context['wikipage']))
    echo '<title>', $context['page_title_html_safe'], '</title>';
Title: Re: Blocks, advanced options
Post by: MultiformeIngegno on November 12, 2009, 06:28:48 AM
Do a search for '<title>' in the index.template.php file for your theme, editing the code there should get you the result that you want.

End result (for the code that echos the SMF page title) could look like:
Code: [Select]
if (empty($context['wikipage']))
    echo '<title>', $context['page_title_html_safe'], '</title>';
It still displays 2 titles in the same page, one is the forum one, the other is the wiki one...

Anyway I've "solved" with this:
Code: [Select]
if (empty($context['wikipage']))
    echo '';

:D
Title: Re: Blocks, advanced options
Post by: Nathaniel on November 12, 2009, 06:38:09 AM
Okay, well I can see from your page that the wiki adds its own <body> and <head> tags, you should try to avoid that if possible. Any HTML headers could be added to the $context['html_headers'] string (before the template_header function is called), for inclusion within SMF's "<head></head>" tags (the tags for the page). Not sure if you can do that with your wiki, but it would definitely be preferable.
Title: Re: Blocks, advanced options
Post by: MultiformeIngegno on November 12, 2009, 06:54:05 AM
Okay, well I can see from your page that the wiki adds its own <body> and <head> tags, you should try to avoid that if possible. Any HTML headers could be added to the $context['html_headers'] string (before the template_header function is called), for inclusion within SMF's "<head></head>" tags (the tags for the page). Not sure if you can do that with your wiki, but it would definitely be preferable.
I can try.. :)

I'm trying also to have a custom <h1> tag for the wiki, so I've modified index.template.php:
Code: [Select]
         <h1 class="forumtitle">
      if (!empty($context['wikipage']))
         echo 'MyWIKI H1';
      else
         echo '<a href="', $scripturl, '">', empty($settings['header_logo_url']) ? $context['forum_name'] : '<img src="' . $settings['header_logo_url'] . '" alt="' . $context['forum_name'] . '" />', '</a>';
            </h1>';

...but I get a syntax error..
Title: Re: Blocks, advanced options
Post by: [SAP]Francis on November 12, 2009, 08:09:09 AM
Code: [Select]
         <h1 class="forumtitle">';
      if (!empty($context['wikipage']))
         echo 'MyWIKI H1';
      else
         echo '<a href="', $scripturl, '">', empty($settings['header_logo_url']) ? $context['forum_name'] : '<img src="' . $settings['header_logo_url'] . '" alt="' . $context['forum_name'] . '" />', '</a>';
      echo '</h1>';

You forgot putting '; after the actual <h1> tag. You also forgot the echo before the finishing </h1> tag.
Title: Re: Blocks, advanced options
Post by: MultiformeIngegno on November 12, 2009, 08:33:49 AM
Thanks Francis!! ;)
Title: Re: Blocks, advanced options
Post by: MultiformeIngegno on November 12, 2009, 04:16:01 PM
How can I display a block only in the portal and in the wiki?
I've tried selecting in "Advanced Options" - "Custom Display Options: portal, wiki" but it's showed only in the portal... not in the wiki... :(
Title: Re: Blocks, advanced options
Post by: [SAP]Francis on November 12, 2009, 04:52:38 PM
Display option:
Code: [Select]
~portal ~action|wiki
I think.
Title: Re: Blocks, advanced options
Post by: MultiformeIngegno on November 12, 2009, 04:56:40 PM
Display option:
Code: [Select]
~portal ~action|wiki
I think.
No... now it's not showed neither in the portal! :P
Title: Re: Blocks, advanced options
Post by: Nathaniel on November 12, 2009, 05:49:08 PM
Try this:
Code: [Select]
portal, ~action|wiki
Also, you'll have to make these edits:
Code: ("Find (Monobook.php)") [Select]
template_header();
Code: ("Replace") [Select]
sportal_init();
template_header();

Code: ("Find (SSI.php)") [Select]
sportal_init();
Code: ("Replace") [Select]
if (empty($context['wikipage']))
   sportal_init();
Title: Re: Blocks, advanced options
Post by: MultiformeIngegno on November 12, 2009, 06:50:29 PM
It's perfect!!!!! :applause: :in-love:
Title: Re: Blocks, advanced options
Post by: [SAP]Francis on November 12, 2009, 07:01:38 PM
Try this:
Code: [Select]
portal, ~action|wiki
Pfft! I was nearly right. *cries*
Title: Re: Blocks, advanced options
Post by: MultiformeIngegno on November 12, 2009, 07:25:43 PM
[SAP]Francis, never mind!! You rock too!! :D
SimplePortal 2.3.8 © 2008-2024, SimplePortal