TinyPortal

Started by lurkalot, February 12, 2005, 04:43:00 AM

Previous topic - Next topic

jsx

Ok, now I understand, I added this first entry and got an error.

Quotenie chcesz włożyć LB do maszyny :D\\

nie chcesz włożyć LB do maszyny :D\

Then I added this second entry and also got an error.

But the entry is not visible in the shoutbox.

davo88

Can you use a php include statement in a TinyPortal HTML article or block? eg

<?php include 'data.php'?>

tinoest

Quote from: davo88 on February 26, 2024, 01:11:05 AMCan you use a php include statement in a TinyPortal HTML article or block? eg

<?php include 'data.php'?>

You'd need a php article or block to include things like the above.

davo88

My example above wasn't very good. Here is a better example from w3schools of how I would like to use it.
So just to clarify, even though the code is HTML, it won't work in a block or article which is defined as 'HTML'? 

<html>
<body>

<h1>Welcome to my home page!</h1>
<p>Some text.</p>
<p>Some more text.</p>
<?php include 'footer.php';?>

</body>
</html>

@rjen

You CANNOT use php in a html block. PHP code will only work in a php block.

So if you wish to do that you code should be all php..
Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

davo88

Thanks for clarifying that. Will go the all php route.

Rupurudu!

I am trying to use TP Standalone mode, but I couldn't get it to work.

Warning:  Undefined array key "front_type" in D:\xampp\forum2.klonoa.local\TinyPortal\Integrate.php on line 405
Warning:  Undefined array key "hideadminmenu" in D:\xampp\forum2.klonoa.local\TinyPortal\Integrate.php on line 413
Warning:  Undefined array key "tp-tphelp" in D:\xampp\forum2.klonoa.local\TinyPortal\Integrate.php on line 420
Fatal error:  Uncaught Error: Call to undefined function TPortal_init() in D:\xampp\forum2.klonoa.local\TPStandalone.php:33
Stack trace:
#0 {main}
  thrown in D:\xampp\forum2.klonoa.local\TPStandalone.php on line 33

Is there any guide to how to properly set this up? There is zero documentation about this feature.


jsx

Quote from: tinoest on February 24, 2024, 03:15:06 PMI have absolutely no idea how it's not tripping this error every time, but its the ; in the member_link causing the issue.

If you add $shout_name = urlencode($shout_name); after $shout_name .= ($user_info['id'] != 0) ? '>'.$context['user']['name'].'</a>' : ''; in TPShout.php this issue will go away.

This solution works. Thanks.

jsx

@tinoest

I'm back here with a report. I noticed this bug when this code is added:

$shout_name = urlencode($shout_name);



tinoest

Quote from: Rupurudu! on February 28, 2024, 09:54:16 AMI am trying to use TP Standalone mode, but I couldn't get it to work.

Warning:  Undefined array key "front_type" in D:\xampp\forum2.klonoa.local\TinyPortal\Integrate.php on line 405
Warning:  Undefined array key "hideadminmenu" in D:\xampp\forum2.klonoa.local\TinyPortal\Integrate.php on line 413
Warning:  Undefined array key "tp-tphelp" in D:\xampp\forum2.klonoa.local\TinyPortal\Integrate.php on line 420
Fatal error:  Uncaught Error: Call to undefined function TPortal_init() in D:\xampp\forum2.klonoa.local\TPStandalone.php:33
Stack trace:
#0 {main}
  thrown in D:\xampp\forum2.klonoa.local\TPStandalone.php on line 33

Is there any guide to how to properly set this up? There is zero documentation about this feature.

What is the path for your main forum relative to the standalone one?

It should work.. however I think it probably has been forgotten about in the most recent release.

tinoest

Quote from: jsx on February 28, 2024, 04:32:46 PM@tinoest

I'm back here with a report. I noticed this bug when this code is added:

$shout_name = urlencode($shout_name);




I can't see that image or what you are trying to tell me is the bug?

tinoest

Quote from: tinoest on March 01, 2024, 08:26:52 AM
Quote from: jsx on February 28, 2024, 04:32:46 PM@tinoest

I'm back here with a report. I noticed this bug when this code is added:

$shout_name = urlencode($shout_name);




I can't see that image or what you are trying to tell me is the bug?

I think you are trying to tell me the link is now encoded, if so change this in TPShout.php line 1130


'poster' => $row['member_link'],
'poster' => urldecode($row['member_link']),

tinoest

Quote from: tinoest on March 01, 2024, 08:26:16 AM
Quote from: Rupurudu! on February 28, 2024, 09:54:16 AMI am trying to use TP Standalone mode, but I couldn't get it to work.

Warning:  Undefined array key "front_type" in D:\xampp\forum2.klonoa.local\TinyPortal\Integrate.php on line 405
Warning:  Undefined array key "hideadminmenu" in D:\xampp\forum2.klonoa.local\TinyPortal\Integrate.php on line 413
Warning:  Undefined array key "tp-tphelp" in D:\xampp\forum2.klonoa.local\TinyPortal\Integrate.php on line 420
Fatal error:  Uncaught Error: Call to undefined function TPortal_init() in D:\xampp\forum2.klonoa.local\TPStandalone.php:33
Stack trace:
#0 {main}
  thrown in D:\xampp\forum2.klonoa.local\TPStandalone.php on line 33

Is there any guide to how to properly set this up? There is zero documentation about this feature.

What is the path for your main forum relative to the standalone one?

It should work.. however I think it probably has been forgotten about in the most recent release.

Try the below, although adjust the SSI.php and Settings.php locations.

<?php
/**
 * TPStandalone.php
 *
 * @package TinyPortal
 * @version 2.1.0
 * @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) - The TinyPortal Team
 *
 */
ob_start('tp_url_rewrite');


global 
$boardurl$context$sourcedir;

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

$actual_boardurl    $boardurl;

require_once(
'../SSI.php');
require_once(
$sourcedir '/TPortal.php');

TPortal_init();

$context['TPortal']['front_type'] = 'forum_articles';
doTPfrontpage();

writeLog();

TPortalMain();

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;
}}}

?>

jsx

Quote from: tinoest on March 01, 2024, 08:26:52 AMI can't see that image or what you are trying to tell me is the bug?

Yes, because after entering this code:

Quote from: tinoest on February 24, 2024, 03:15:06 PMI have absolutely no idea how it's not tripping this error every time, but its the ; in the member_link causing the issue.

If you add
$shout_name = urlencode($shout_name); after
$shout_name .= ($user_info['id'] != 0) ? '>'.$context['user']['name'].'</a>' : ''; in TPShout.php this issue will go away.

I got the error that I showed you in the screenshot.

tinoest

Quote from: jsx on March 01, 2024, 04:26:11 PM
Quote from: tinoest on March 01, 2024, 08:26:52 AMI can't see that image or what you are trying to tell me is the bug?

Yes, because after entering this code:

Quote from: tinoest on February 24, 2024, 03:15:06 PMI have absolutely no idea how it's not tripping this error every time, but its the ; in the member_link causing the issue.

If you add
$shout_name = urlencode($shout_name); after
$shout_name .= ($user_info['id'] != 0) ? '>'.$context['user']['name'].'</a>' : ''; in TPShout.php this issue will go away.

I got the error that I showed you in the screenshot.

Which as I said I can't see, it's far too small on my phone.

Did the change I suggested after work?

jsx

Quote from: tinoest on March 01, 2024, 04:50:35 PMWhich as I said I can't see, it's far too small on my phone.

And now do you see this screen better?

https://i.imgur.com/zs0lFol.png

Quote from: tinoest on March 01, 2024, 04:50:35 PMDid the change I suggested after work?

Do you mean this code:

$shout_name = urlencode($shout_name);
I added after this code?

$shout_name .= ($user_info['id'] != 0) ? '>'.$context['user']['name'].'</a>' : '';
That's exactly what I did.

Quote from: tinoest on March 01, 2024, 08:37:35 AMI think you are trying to tell me the link is now encoded, if so change this in TPShout.php line 1130

'poster' => $row['member_link'],
'poster' => urldecode($row['member_link']),

This solution decoded this link. Thanks.

Rupurudu!

#3676
    Quote from: tinoest on March 01, 2024, 09:57:27 AM
    Quote from: tinoest on March 01, 2024, 08:26:16 AM
    Quote from: Rupurudu! on February 28, 2024, 09:54:16 AMI am trying to use TP Standalone mode, but I couldn't get it to work.

    Warning:  Undefined array key "front_type" in D:\xampp\forum2.klonoa.local\TinyPortal\Integrate.php on line 405
    Warning:  Undefined array key "hideadminmenu" in D:\xampp\forum2.klonoa.local\TinyPortal\Integrate.php on line 413
    Warning:  Undefined array key "tp-tphelp" in D:\xampp\forum2.klonoa.local\TinyPortal\Integrate.php on line 420
    Fatal error:  Uncaught Error: Call to undefined function TPortal_init() in D:\xampp\forum2.klonoa.local\TPStandalone.php:33
    Stack trace:
    #0 {main}
      thrown in D:\xampp\forum2.klonoa.local\TPStandalone.php on line 33

    Is there any guide to how to properly set this up? There is zero documentation about this feature.

    What is the path for your main forum relative to the standalone one?

    It should work.. however I think it probably has been forgotten about in the most recent release.

    Try the below, although adjust the SSI.php and Settings.php locations.

    <?php
    /**
     * TPStandalone.php
     *
     * @package TinyPortal
     * @version 2.1.0
     * @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) - The TinyPortal Team
     *
     */
    ob_start('tp_url_rewrite');


    global 
    $boardurl$context$sourcedir;

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

    $actual_boardurl    $boardurl;

    require_once(
    '../SSI.php');
    require_once(
    $sourcedir '/TPortal.php');

    TPortal_init();

    $context['TPortal']['front_type'] = 'forum_articles';
    doTPfrontpage();

    writeLog();

    TPortalMain();

    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;
    }}}

    ?>
    This code works! Thanks.
    But there is a problem, none of the TinyPortal items show up on the Navigation Bar.

    Now I want to point the boardindex to the forum. Currently main page ($boardurl/index.php) shows the portal page while $boardurl/index.php?action=forum shows the forum.

    Edit:
    This is how I did it:
    /TinyPortal/Integrate.php
    Find:
            // We can use a hook of sorts for the default actions now
            updateSettings(array('integrate_default_action' => 'TinyPortal\Integrate::hookDefaultAction'));
    Replace:
            // Don't change the boardindex.
            updateSettings(array('integrate_default_action' => ''));

    But there also another problem, both the Home and Forum links on the Navigation menu points to the Forum now.
    Edit2:
    Another edit is needed on /TinyPortal/Integrate.php.
    Find:
            // Set the forum button activated if needed.
            if(isset($_GET['board']) || isset($_GET['topic'])) {
                $context['current_action'] = 'forum';
            }
    Replace:
            // Set the forum button activated if needed.
            if(isset($_GET['board']) || isset($_GET['topic']) || (empty(isset($_GET['board'])) && empty(isset($_GET['topic'])))) {
                $context['current_action'] = 'forum';
            }

    // Change the href of the 'home' button:
    $buttons['home']['href'] = "/TPStandalone.php";
    [/list]

    Rupurudu!

    #3677
    I can't edit my last message anymore, but don't do these edits. If you remove this line articles do not work.
    updateSettings(array('integrate_default_action' => 'TinyPortal\Integrate::hookDefaultAction'));


    I tried to fix the TinyPortal items not showing up on the Navigation Bar, but couldn't. And navigation bar is not the only issue, It also doesn't show up the SMF and TinyPortal copyright on the footer. I found out that SMF doesn't show it's own copyright when it's in SSI mode, but couldn't have an explaination why TinyPortal's doesn't show up.

    I tried to debug it by adding this code to 'TPAddIntegrationFunction'.

    trigger_error("add_integration_function called with " . $hook .', '. $call .', '. $perm.'. ', E_USER_WARNING);
    Both 'TinyPortal\Integrate::hookMenuButtons' and 'TinyPortal\Integrate::hookBuffer' are called, but their modifications do not show up.



    I just created a pull request on the GitHub: https://github.com/Tinyportal/TinyPortal/pull/1013 [nofollow]

    BCK

    Hi,,,Just wanted to say Thank You to all involved in this portal, It works flawless for me, and I can't express how great it and the support is for it,,,Truly impressed..

    Advertisement: