News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

TinyPortal

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

Previous topic - Next topic

tinoest

Any errors in the log? Most likely the Apache/nginx error log

Also what version of PHP are you using and installed packages.

@rjen

No clue. What is in your server error log?
Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

fmofmpls

My version of PHP is 7.2 and I don't see any obvious errors regarding TP

fmofmpls

Here are my installed mods. Only two are actually installed. I can't get TP to install.

Steve

Quick side question: why do you have two versions of the same mod installed?
My pet rock is not feeling well. I think it's stoned.

fmofmpls

Quote from: Steve on May 05, 2024, 08:36:43 AMQuick side question: why do you have two versions of the same mod installed?

It is a test forum and I simply forgot to uninstall the "lite" version.

@rjen

Quote from: fmofmpls on May 04, 2024, 05:44:04 PMHere are my installed mods. Only two are actually installed. I can't get TP to install.

Did you check the SERVER error log? Getting a white screen will most likely be something that's not logged in the forum logs. From your answer it's not clear what log you checked...
Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

tinoest

It's a long time since I tested on PHP 7.2 or anything less than PHP 8.0 for that matter.

@rjen have you done any testing on that version? A white page is most likely due to a php error. The server log will show the error mind.

I meant PHP packages installed btw not other SMF modifications.

jsx

Does the TPortal::is_frontpage() or is_frontpage function exist in TinyPortal?


@rjen

Why are you asking?
Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

jsx

My friend with whom I run the forum has a license for SMFPacks Shoutbox Pro and there is a problem that Shoutbox is displayed on the main page of the forum portal. Generally speaking, a friend asked on SMFPacks support how to solve this and received a link to a thread from 2014 in which someone asked about changing the position of the shoutbox display in TinyPortal.

https://www.smfpacks.com/b136/shoutbox-integration-tinyportal-block/2387/

If I remember correctly, on SMF 2.0.x SMFPacks Shoutbox Pro was not permanently displayed on the home page of the forum portal. This happens on SMF 2.1. It's possible that my friend and I didn't understand the above help thread, so I asked ChatGPT how to solve this problem. And he gave me two solutions:

ChatBOT:

To hide the shoutbox on the homepage of the TinyPortal site, we can add a condition to check if we are on that page before displaying the shoutbox. If TinyPortal does not have a defined function to check if we are on the homepage, we will need to determine this manually.

Below, I present a modified version of your code in the Shoutbox.template.php file, which adds a condition to check if we are on the homepage of the portal. We can do this by checking the URL or another variable specific to TinyPortal. I assume we can use the global variable $context or another similar variable that contains information about the current page.

Example of code with a URL condition:

Let's assume that the homepage of the portal has a specific URL, e.g., index.php?action=portal.

function template_shoutbox_above()
{
    global $shoutbox, $context;

    // Check if we are not on the homepage of the portal
    if (empty($shoutbox['showShoutboxBottom']) && !(isset($_GET['action']) && $_GET['action'] == 'portal')) {
        template_shoutbox('main');
    }
}

function template_shoutbox_below()
{
    global $shoutbox, $context;

    // Check if we are not on the homepage of the portal
    if (!empty($shoutbox['showShoutboxBottom']) && !(isset($_GET['action']) && $_GET['action'] == 'portal')) {
        template_shoutbox('main');
    }
}

Example of code with a TinyPortal condition:

If TinyPortal defines a special global variable or function that we can use to check if we are on the homepage of the portal, we will use that instead of the above condition.

function template_shoutbox_above()
{
    global $shoutbox, $context;

    // Check if we are not on the homepage of the portal
    if (empty($shoutbox['showShoutboxBottom']) && !defined('TPortal') || !TPortal::is_frontpage()) {
        template_shoutbox('main');
    }
}

function template_shoutbox_below()
{
    global $shoutbox, $context;

    // Check if we are not on the homepage of the portal
    if (!empty($shoutbox['showShoutboxBottom']) && !defined('TPortal') || !TPortal::is_frontpage()) {
        template_shoutbox('main');
    }
}

Summary:

Adding a URL condition: This is the simplest way if the homepage of the portal has a specific URL.

TinyPortal condition: If TinyPortal has a special variable or function that can be used, utilize that.

The above solutions should help hide the shoutbox on the homepage of the portal while allowing it to be displayed on other pages of the forum. If you encounter any problems or need further assistance, let me know.

***

@rjen I checked these two codes and each cause that SMFPacks Shoutbox is not displayed on the portal home page, but only on the forum home page. And this is what my friend and I wanted to achieve, so that Shoutbox would not be displayed on the home page of the forum portal.

I wrote to ChatBOT that both codes work correctly and it wrote back to me:

Both codes work correctly, but they differ in their approach to checking if we are on the TinyPortal homepage. The choice of which code is better depends on several factors:

Accuracy and Reliability:

The first code checks the URL of the page ($_GET['action'] == 'portal'). This is a simple and straightforward method, but it may be less flexible if the homepage URL changes or if there are other cases where the shoutbox should be hidden.

The second code uses a potentially available function or variable defined by TinyPortal (TPortal::is_frontpage()). If such a function or variable exists and is well-defined by TinyPortal, this is a more elegant and future-proof solution.

Readability and Maintenance:

The first code is more universal and easier to understand but requires knowledge of the portal's URL structure.
The second code may be more complex to understand but better integrates with TinyPortal, provided that the TPortal::is_frontpage() function exists and works correctly.

Recommendation:

If TPortal::is_frontpage() or an appropriate global variable is well-documented and available in TinyPortal, I recommend using the second code because it is more elegant and better integrated with TinyPortal's logic. Using the portal's native function or variable ensures better reliability in the case of future TinyPortal updates.

Note:

If TPortal::is_frontpage() is not available, use the first code, which is more universal:

function template_shoutbox_above()
{
    global $shoutbox, $context;

    // Check if we are not on the homepage of the portal
    if (empty($shoutbox['showShoutboxBottom']) && !(isset($_GET['action']) && $_GET['action'] == 'portal')) {
        template_shoutbox('main');
    }
}

function template_shoutbox_below()
{
    global $shoutbox, $context;

    // Check if we are not on the homepage of the portal
    if (!empty($shoutbox['showShoutboxBottom']) && !(isset($_GET['action']) && $_GET['action'] == 'portal')) {
        template_shoutbox('main');
    }
}

I replied to ChatBOT:

Where can I check if this function TPortal::is_frontpage() exists?

ChatBOT replied to me:

To check if the TPortal::is_frontpage() function exists, you need to review the TinyPortal documentation or the TinyPortal source code. You can also add a short snippet of code to your project to see if the function is available.

Method 1: Checking the TinyPortal Documentation

1. Go to the TinyPortal documentation website.

2. Search for information about available functions, especially those related to checking if you are on the homepage.

Method 2: Searching the TinyPortal Source Code

1. Open the directory with the TinyPortal files.

2. Use a file searching tool (e.g., grep in Linux, the search function in a text editor) to search for the phrase is_frontpage.

3. Check the results to see where and how this function is defined.

Method 3: Adding Checking Code to the Project

Add the following code to one of your forum's PHP files (e.g., in the index.php or Shoutbox.template.php file) and load the page to check if the function exists.

if (class_exists('TPortal') && method_exists('TPortal', 'is_frontpage')) {
    echo "The function TPortal::is_frontpage() exists.";
} else {
    echo "The function TPortal::is_frontpage() does not exist.";
}

If the function exists:

If the above code returns information that the function exists, you can safely use the following code in the Shoutbox.template.php file:

function template_shoutbox_above()
{
    global $shoutbox, $context;

    // Check if we are not on the homepage of the portal
    if (empty($shoutbox['showShoutboxBottom']) && (!defined('TPortal') || !TPortal::is_frontpage())) {
        template_shoutbox('main');
    }
}

function template_shoutbox_below()
{
    global $shoutbox, $context;

    // Check if we are not on the homepage of the portal
    if (!empty($shoutbox['showShoutboxBottom']) && (!defined('TPortal') || !TPortal::is_frontpage())) {
        template_shoutbox('main');
    }
}

If the function does not exist:

If the function does not exist, resort to the first solution of checking the URL:

function template_shoutbox_above()
{
    global $shoutbox, $context;

    // Check if we are not on the homepage of the portal
    if (empty($shoutbox['showShoutboxBottom']) && !(isset($_GET['action']) && $_GET['action'] == 'portal')) {
        template_shoutbox('main');
    }
}

function template_shoutbox_below()
{
    global $shoutbox, $context;

    // Check if we are not on the homepage of the portal
    if (!empty($shoutbox['showShoutboxBottom']) && !(isset($_GET['action']) && $_GET['action'] == 'portal')) {
        template_shoutbox('main');
    }
}

@rjen What do you think about it?

tinoest

Neither of those solutions will work.

As we don't have a action=portal or a TPortal::is_frontpage(), if we did have an is_frontpage it would just say if we were enabled on the front page, not actually on the front page.

jsx

I confirm that both codes work, both codes prevent SMFPacks Shoutbox from displaying on the portal homepage.

The code also causes the shoutbox do not display on the portal's homepage.

function template_shoutbox_above()
{
    global $shoutbox, $context;
 
    // Check if the current page is the main page of the SMF forum.
    if (!empty($context['current_action']) && $context['current_action'] === 'forum') {
        if (empty($shoutbox['showShoutboxBottom']))
            template_shoutbox('main');
    }
}

function template_shoutbox_below()
{
    global $shoutbox, $context;
 
    // Check if the current page is the main page of the SMF forum.
    if (!empty($context['current_action']) && $context['current_action'] === 'forum') {
        if (!empty($shoutbox['showShoutboxBottom']))
            template_shoutbox('main');
    }
}

tinoest

The TPortal::is_frontpage can only be working if it's breaking the rendering so that the shoutbox isn't displayed. You'll have errors in the logs for that as we don't have that function to even call.

Dave J

Please note I posted this on TP website, but thought I might as well post it here.

This is for TP3.0

TP is causing the dropmenu items to be cut short at the bottom under certain menus in the admin. See attached images.

This is not a serious issue that can't be lived with in the short term but ideally it should be resolved as soon as possible.

I did uninstall a few mods before I found out that removing TP stopped the issue from happening, I haven't noticed this issue before today so I'm not sure how long it's been happening.

I did get a reply from @rjen

QuoteI can reproduce it.

Probably caused by the portal divs being added and a z index or overflow css.

This will only happen on pages without any content, so if I happen to find it I will fix it, but am not going to spend much time looking

Following his comments I had a good look around and found a fix that works for me, this might not be code correct but it does work and at present there have been no errors.

Fix is

Default theme>css>tp-style.css

go to line 57

was

#tptopbarHeader, #tpbottombarHeader, #mainContainer, #mainContainer > div,
#tpcenterbarHeader, #tplowerbarHeader {
overflow:hidden;
}

now

#tptopbarHeader, #tpbottombarHeader, #tpcenterbarHeader, #tplowerbarHeader {
overflow:hidden;
}

@rjen

Quote from: Dave J on May 30, 2024, 08:41:47 AMFollowing his comments I had a good look around and found a fix that works for me, this might not be code correct but it does work and at present there have been no errors.

Fix is

Default theme>css>tp-style.css

go to line 57

was

#tptopbarHeader, #tpbottombarHeader, #mainContainer, #mainContainer > div,
#tpcenterbarHeader, #tplowerbarHeader {
    overflow:hidden;
}

now

#tptopbarHeader, #tpbottombarHeader, #tpcenterbarHeader, #tplowerbarHeader {
    overflow:hidden;
}


This change will give you layout issues if you are on pages using the side panels: the main container will start showing incorrect layouts...

Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

Dave J

Quote from: @rjen on May 30, 2024, 02:56:43 PMThis change will give you layout issues if you are on pages using the side panels: the main container will start showing incorrect layouts...

I'm not seeing anything like you've posted, all my cat bars and title bars are fine and so are the side panels

Aizenplaysgames

I was dumb and clicked away the "hide shoutbox on admin", now the entire forum gives ERR_TOO_MANY_REDIRECTS. That includes any admin parts so I cant remove the package.

Only got access to the FTP, anyone know anything about what "file" to edit or remove?.

Kind of desperate here.

Dave J

Quote from: Aizenplaysgames on July 10, 2024, 02:51:12 AMI was dumb and clicked away the "hide shoutbox on admin", now the entire forum gives ERR_TOO_MANY_REDIRECTS. That includes any admin parts so I cant remove the package.

Only got access to the FTP, anyone know anything about what "file" to edit or remove?.

Kind of desperate here.

It's possible the changes have been made in the database, if you have a recent backup of your database then copy just the tables for TP and upload them to current database, make a new backup first, just in case. You will need to remove the existing TP tables then add the old ones. If you just do the TP tables it wont affect anything else on the site, you may lose some shouts in the shoutbox though.

Antechinus

You should still have access to phpMyAdmin, in which case you could revert that setting directly in the database. That's not difficult, although offhand I do not know which setting it is (Rjen will know). That should be less trouble than using a backup.

Advertisement: