Login  |  Register
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome, Guest. Please login or register.
Did you miss your activation email?

January 27, 2021, 07:46:46 PM

Login with username, password and session length
Members
Stats
  • Total Posts: 191755
  • Total Topics: 20943
  • Online Today: 134
  • Online Ever: 1035
  • (November 26, 2020, 04:45:12 AM)
Users Online
Users: 0
Guests: 55
Total: 55

Author Topic: TinyPortal Standalone  (Read 7896 times)

0 Members and 1 Guest are viewing this topic.

Offline tino

  • Developer
  • *
  • Posts: 2213
TinyPortal Standalone
« on: June 09, 2018, 11:34:35 AM »
Not sure where this should go...

If you want to have your TinyPortal index on a different page/url to the main forum then you can do the following.

Code: [Select]
<?php

$ssi_path       
'/path/to/SSI.php';
$forum_path     '/forum';

require_once(
$ssi_path);

ob_start('tp_url_rewrite');

loadTheme();

TPortal_init();
writeLog();

call_user_func(whichTPAction());

obExit(true);

function 
tp_url_rewrite($buffer)
{
        global 
$forum_path;
        if (!empty(
$buffer) && stripos($buffer$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']) !== false) {
                
$buffer str_replace($_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'], $_SERVER['SERVER_NAME'].$forum_path.$_SERVER['REQUEST_URI'], $buffer);
        }       
        
        return 
$buffer;
}       

?>


I couldn't work out why the menu url etc was set to where I was rather than the path of the forum... so I just rewrote it. A bit of a hack but it works... assumes that you are using index.php on the main page.
« Last Edit: June 09, 2018, 12:07:20 PM by tino »

Offline bigguy

  • Beta Tester
  • *
  • Posts: 272
  • Be Nice...
    • What's Ur Beef
Re: TinyPortal Standalone
« Reply #1 on: August 17, 2019, 07:11:07 AM »
Would this work for 2.1 ? How is it used exactly. Do I need to make a file named index.php and put this in it. ??

Offline bigguy

  • Beta Tester
  • *
  • Posts: 272
  • Be Nice...
    • What's Ur Beef
Re: TinyPortal Standalone
« Reply #2 on: August 17, 2019, 07:37:33 AM »
It does work, lol. Cool.

Offline lurkalot

  • Administrator
  • *
  • Posts: 7116
    • Camera Craniums
Re: TinyPortal Standalone
« Reply #3 on: August 17, 2019, 07:53:36 AM »
It does work, lol. Cool.

Yes t should work.  I haven't tested or tried it myself, I was hoping tino would see this and answer for you as he wrote it for us. But glad you worked it out.

So where did you test this, got an example BG?

Offline bigguy

  • Beta Tester
  • *
  • Posts: 272
  • Be Nice...
    • What's Ur Beef
Re: TinyPortal Standalone
« Reply #4 on: August 17, 2019, 08:06:03 AM »
Here check the url out. If you try to use it without the /index.php it seems as though the style does not load, also there is no forum button but it does show up.
Link removed as this is a test site. (Lurkalot knows it though)

Offline bigguy

  • Beta Tester
  • *
  • Posts: 272
  • Be Nice...
    • What's Ur Beef
Re: TinyPortal Standalone
« Reply #5 on: August 17, 2019, 08:06:45 AM »
Well, I guess there is a forum button but it says home.

Offline bigguy

  • Beta Tester
  • *
  • Posts: 272
  • Be Nice...
    • What's Ur Beef
Re: TinyPortal Standalone
« Reply #6 on: August 17, 2019, 08:10:03 AM »
And I can't login on that page either.

Offline lurkalot

  • Administrator
  • *
  • Posts: 7116
    • Camera Craniums
Re: TinyPortal Standalone
« Reply #7 on: August 17, 2019, 08:17:11 AM »
I don't have any answers for you atm.  I'm wondering what would happen if you had your portal front page settings set to, "Go directly to forum index"

Offline bigguy

  • Beta Tester
  • *
  • Posts: 272
  • Be Nice...
    • What's Ur Beef
Re: TinyPortal Standalone
« Reply #8 on: August 17, 2019, 08:19:59 AM »
They are on "Redirect to forum".

Offline bigguy

  • Beta Tester
  • *
  • Posts: 272
  • Be Nice...
    • What's Ur Beef
Re: TinyPortal Standalone
« Reply #9 on: August 19, 2019, 03:38:30 AM »
OK, it was my cookie settings. This works fine now.

Offline Maxxim

  • Jr. Member
  • **
  • Posts: 12
Re: TinyPortal Standalone
« Reply #10 on: May 24, 2020, 07:25:37 AM »
A bit of a hack but it works... assumes that you are using index.php on the main page.

Thanks a lot for this, @tino! This is exactly what I was looking for.
The code seems to work, but on my localhost WAMP setup (Windows 10, Apache 2.4, MySQL 5.7, PHP 7.1) it also displays the following:
Code: [Select]
Warning: call_user_func() expects parameter 1 to be a valid callback, no array or string given in <full path to www root>\index.php on line 15
I've got some IT background, but I'm definitely not a coder, so I would appreciate any help in dealing with this.

Offline tino

  • Developer
  • *
  • Posts: 2213
Re: TinyPortal Standalone
« Reply #11 on: May 24, 2020, 11:28:39 AM »
Can you make sure that the hook which calls this file exists TPassimilate.php

I don’t think it’s loading properly for that error to appear

Offline Maxxim

  • Jr. Member
  • **
  • Posts: 12
Re: TinyPortal Standalone
« Reply #12 on: May 25, 2020, 02:40:27 AM »
TPassimilate.php is in Sources directory where it belongs. I compared it with the one included in TinyPortal-1.6.6.zip, and it's a 100% match.

As for other installed mods, I only have Pretty URLs 2.3. Tried disabling it, but that didn't make the warning go away. I'm running SMF 2.0.17.

Offline tino

  • Developer
  • *
  • Posts: 2213
Re: TinyPortal Standalone
« Reply #13 on: May 25, 2020, 05:15:01 AM »
Not the file itself the hook in the hooks area should be listed. It’s in one of the admin sections, can never remember where mind.

If not SSI.php might not be including TinyPortal correctly.

Offline lurkalot

  • Administrator
  • *
  • Posts: 7116
    • Camera Craniums
Re: TinyPortal Standalone
« Reply #14 on: May 25, 2020, 05:55:53 AM »
Not the file itself the hook in the hooks area should be listed. It’s in one of the admin sections, can never remember where mind.

If not SSI.php might not be including TinyPortal correctly.

Tino, don't think, or at least I haven't seen it in the 2.0.17  It's easily findable in 2.1 in maintenance > Forum Maintenance > Integration Hooks.

Offline vbgamer45

  • Jr. Member
  • **
  • Posts: 12
    • SMFHacks.com
Re: TinyPortal Standalone
« Reply #15 on: May 25, 2020, 09:51:57 PM »

Offline Maxxim

  • Jr. Member
  • **
  • Posts: 12
Re: TinyPortal Standalone
« Reply #16 on: May 25, 2020, 10:31:16 PM »
I've installed emanuele's Integration Hooks Report (?mod=3285), and here's what it shows:
(waiting for moderator to approve image attachment :)

PS. sniped by @vbgamer45 XD

PPS. The code seems to work only if I specify
Code: [Select]
$ssi_path       = './forum/SSI.php';
$forum_path     = '';

If I set
Code: [Select]
$forum_path     = '/forum'; (which makes sense because that's where forum files are located), it fails to apply theming to the output.

Offline lurkalot

  • Administrator
  • *
  • Posts: 7116
    • Camera Craniums
Re: TinyPortal Standalone
« Reply #17 on: May 26, 2020, 12:51:02 AM »
Tino, I don't know if this has any relevance.

In your code, first post of this topic, this line,

Code: [Select]
loadTheme();
I noticed in the included (in package) TP TPStanalone.php file it has this

Code: [Select]
loadTheme(1, false);

Offline Maxxim

  • Jr. Member
  • **
  • Posts: 12
Re: TinyPortal Standalone
« Reply #18 on: May 26, 2020, 04:10:24 AM »
I also noticed that Integration Hooks Report left 38 pages of error messages in my SMF Error Log. Looks like whenever it's called, it produces two errors, "Array to string conversion" and "Undefined variable: Array".

The offender is line 327 in Subs-IntegrationHooks.php (the mod's file):
Code: [Select]
$sort[] = $$sort_options[0];I wonder if we can trust the tool's output.

Unfortunately, the mod's authors are not around any more, so chances of getting support are very slim.

Offline tino

  • Developer
  • *
  • Posts: 2213
Re: TinyPortal Standalone
« Reply #19 on: May 26, 2020, 12:39:05 PM »
The one included might work better, I’ve not tested it in a while tbf. I had hoped to find some time to look at it this week in a test install but time as always is fleeting atm.

Offline tino

  • Developer
  • *
  • Posts: 2213
Re: TinyPortal Standalone
« Reply #20 on: May 29, 2020, 02:57:00 AM »
I just tried the one packaged in with TinyPortal 1.6.x with SMF 2.0 and it works ok if I add the $forum_version into the script (otherwise TPShout has a issue)

The one on Github for TinyPortal 2.0.0 also works as expected without any modifications.

The one on the opening post here is out of date.

This is what is needed for TinyPortal 1.6.x

https://github.com/Tinyportal/TinyPortal/blob/1.6.x/TPStandalone.php

Adding the SMF Version before the loadTheme line

Code: [Select]
$forum_version  = 'SMF 2.0.17';

Offline Maxxim

  • Jr. Member
  • **
  • Posts: 12
Re: TinyPortal Standalone
« Reply #21 on: May 29, 2020, 08:24:06 AM »
Thank you, Tino, that seems to work now! :)

However... Either I'm doing something wrong here or it doesn't play nice with custom themes (even with Curve derivatives like Ant's Mutant Curve). It does load the theme I specify in loadTheme(), but it totally mangles the linktree area and the footer. :(

Offline tino

  • Developer
  • *
  • Posts: 2213
Re: TinyPortal Standalone
« Reply #22 on: May 29, 2020, 09:50:37 AM »
I never tried it with a custom theme. I’ll have a look this weekend and see what’s causing that.

Offline tino

  • Developer
  • *
  • Posts: 2213
Re: TinyPortal Standalone
« Reply #23 on: May 29, 2020, 11:07:29 AM »
Try the below

Code: [Select]
<?php
/**
 * TPStandalone.php
 *
 * @package TinyPortal
 * @version 1.6.7
 * @author tinoest - http://www.tinyportal.net
 * @founder Bloc
 * @license MPL 2.0
 *
 * The contents of this file are subject to the Mozilla Public License Version 2.0
 * (the "License"); you may not use this package except in compliance with
 * the License. You may obtain a copy of the License at
 * http://www.mozilla.org/MPL/
 *
 * Copyright (C) 2020 - The TinyPortal Team
 *
 */
ob_start('tp_url_rewrite');
global 
$boardurl$context$txt;

$txt['tp-tphelp']   = 'TinyPortal';

$forum_version      'SMF 2.0.17';
$forum_path         '/var/www/html/forum/';

require_once(
$forum_path '/Settings.php');

$context['TPortal'] = array();
$actual_boardurl    $boardurl;

require_once(
$forum_path '/SSI.php');

TPortal_init();

writeLog();

call_user_func(whichTPAction());

obExit(true);

function 
tp_url_rewrite($buffer) {{{
    global 
$actual_boardurl$boardurl;
    if (!empty(
$buffer) && stripos($buffer$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']) !== false) {
        
$buffer str_replace($boardurl$actual_boardurl$buffer);
    }

    return 
$buffer;
}}}

?>


Offline Maxxim

  • Jr. Member
  • **
  • Posts: 12
Re: TinyPortal Standalone
« Reply #24 on: May 29, 2020, 10:46:31 PM »
It seems to work flawlessly now with several custom themes and Pretty URLs enabled.  :D
A triple huzzah for Tino! O0 O0 O0

Offline makuta_iii

  • Newbie
  • *
  • Posts: 3
Re: TinyPortal Standalone
« Reply #25 on: July 05, 2020, 12:43:49 PM »
Hi.
Is such a solution possible (of course, if you make the necessary changes) to display the main page of the portal on a separate page, if you put this code in the file portal.php? My forum is located at forum.wabisabi.by and i would like to see the portal Frontpage with articles at link forum.wabisabi.by/portal. This is now implemented on this forum, but not using your portal, unfortunately.
Sorry if I repeat my question, but this is the only problem that I can not solve to install your portal on my forum.

Thanks.