News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

TinyPortal

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

Previous topic - Next topic

tinoest

if ( isset( $_SERVER['HTTP_SEC_CH_UA_MOBILE'] ) ) {
// This is the `Sec-CH-UA-Mobile` user agent client hint HTTP request header.
// See <https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Sec-CH-UA-Mobile>.
$is_mobile = ( '?1' === $_SERVER['HTTP_SEC_CH_UA_MOBILE'] );
} elseif ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) {
$is_mobile = false;
} elseif ( str_contains( $_SERVER['HTTP_USER_AGENT'], 'Mobile' ) // Many mobile devices (all iPhone, iPad, etc.)
|| str_contains( $_SERVER['HTTP_USER_AGENT'], 'Android' )
|| str_contains( $_SERVER['HTTP_USER_AGENT'], 'Silk/' )
|| str_contains( $_SERVER['HTTP_USER_AGENT'], 'Kindle' )
|| str_contains( $_SERVER['HTTP_USER_AGENT'], 'BlackBerry' )
|| str_contains( $_SERVER['HTTP_USER_AGENT'], 'Opera Mini' )
|| str_contains( $_SERVER['HTTP_USER_AGENT'], 'Opera Mobi' ) ) {
$is_mobile = true;
} else {
$is_mobile = false;
}

That's the way Wordpress do it, which if it was implemented I'd suggest we do also ignoring screen size etc and just going on the http agent header.

str_contains is PHP 8.0 or greater so we'd want the polyfill for that also.

if (!function_exists('str_contains')) {
    function str_contains(string $haystack, string $needle): bool {
        return '' === $needle || false !== strpos($haystack, $needle);
    }
}

@rjen

Interesting concept, but I am wondering if this is bullit proof:
According to the code an ipad may be considered a mobile device, just as an iphone. Owning an Ipad pro I would not want to treat the display on an Ipad the same as an Iphone...

I can see  a mechanism using one or more selectable widths to control if blocks are shown or hidden, which would better deal with the ambiguity of 'mobile' devices...
Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

tinoest

Selectable widths is also flawed as you can get some which have double the dpi etc, the Wordpress method is the best of a bad choice.

An iPad is a mobile device anyway.

@rjen

Quote from: tinoest on February 08, 2024, 05:31:17 PMAn iPad is a mobile device anyway.

Fully agree. It's just that the screen is larger then my laptop screen...
Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

Arantor

A mobile device with 1024+ width screen though, you don't want to throw that at the same settings as 320-400px width devices.

Sesquipedalian

Quote from: tinoest on February 08, 2024, 05:31:17 PMSelectable widths is also flawed as you can get some which have double the dpi etc,

No, DPI doesn't generally affect anything. CSS @media selectors use "CSS pixels," not actual pixels, in their calculations. CSS pixels are always defined at a nominal 96 DPI. The browser is responsible for scaling that to whatever the real DPI of the screen is. The web designer doesn't need to know or care about the real DPI.

You can and should use CSS width and/or height selectors to make layout decisions, such as hiding or rearranging blocks, rather than trying to use browser sniffing.
I promise you nothing.

Sesqu... Sesqui... what?
Sesquipedalian, the best word in the English language.

tinoest

In which case the end user can add to the custom css to hide/show blocks.

I'm against hiding content on a mobile which is on a desktop anyway, you can resize, restyle well enough with the css options you have.

TP adding css styling inline just seems backwards and counter intuitive. Don't bother even rendering the item in the first place if you don't want it.

ColinJM

OK thanks SOol from my thread https://www.simplemachines.org/community/index.php?topic=588235.0

and your quotes:

Quote from: Sir Osis of Liver on February 16, 2024, 08:15:09 PMYou can enable/disable TP blocks in TP admin if you want to remove the two side columns.  It creates a frontpage with a menu link to the forum.  You can select where in the forum TP is displayed, or not.  Will have to install it in test install to give you more specific info if you need it, only used it on couple of forums.


Quote from: Sir Osis of Liver on February 16, 2024, 08:29:51 PMOk, I've installed current version TP 3.0.0 in 2.1.4.  TP adds a TinyPortal button to main menu that takes you to TP admin.  You can disable individual blocks in Blocks, or remove the right and/or left columns in Panels.  In Frontpage you can select what is displayed on frontpage, where it is displayed, or you can have it go directly to forum index.

and Kindred's instruction:

Quote from: Kindred on February 16, 2024, 08:57:38 PMYou should also address questions about how tinyportal works in the thread or website dedicated to supporting tinyportal

Thank SOol, that sorted out the unwanted side panels and home page pointing now, how do I get the log in screen to point to another URL please?



Kind Regards

Colin

Sir Osis of Liver

Where do you want it to go?
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Sir Osis of Liver

From your other topic looks like you want login to go directly to forum index.  You can set this in TP Admin > Frontpage.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

@rjen

This conversation is now dropped in here, but I am not seeing a clear question being asked?
Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

ColinJM

Quote from: lurkalot on February 17, 2024, 01:09:46 AMIn TinyPortal > Settings

How to redirect after login: Select either,

Redirect to forum.
Redirect to frontpage.

And Save.

On that same Settings page, you can hide the TinyPortal menu so it only shows to Admins, by checking the box next to, "Hide TinyPortal menu option"

And save.

You can basically make the portal as invisible as you want.


Selecting either redirects doesn't seem to make any difference - both go to the forum home page.

Thanks for the tip on visisibilty.
Kind Regards

Colin

ColinJM

Quote from: Sir Osis of Liver on February 16, 2024, 09:26:52 PMWhere do you want it to go?


Quote from: Sir Osis of Liver on February 16, 2024, 09:55:07 PMFrom your other topic looks like you want login to go directly to forum index.  You can set this in TP Admin > Frontpage.

Just saw your posts - I want to go from the log in screen to a website address which then points to various board, sub boards and threads.
Kind Regards

Colin

@rjen

I feel you are missing the point of using a portal: you can use the portal FrontPage to make a page directing to various pages and boards.

The portal is not a redirect to an outside website

An example: https://www.tinyportal.net/docs/
Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

ColinJM

#3594
[quote author=@rjen link=msg=4170015 date=1708152597]
I feel you are missing the point of using a portal: you can use the portal FrontPage to make a page directing to various pages and boards.

The portal is not a redirect to an outside website

An example: https://www.tinyportal.net/docs/
[/quote]

Fair comment @rjen - I do appreciate tinyportal is it's own cms internal to the whole simple machines internal forum framework and fully intend to use the correct approach but in the meantime I'm getting pressure to provide a more image block forum entry point and I can currently do it much faster external (using a WYSIWYG web site builder).
Kind Regards

Colin

lurkalot

Quote from: ColinJM on February 17, 2024, 01:31:20 AMSelecting either redirects doesn't seem to make any difference - both go to the forum home page.

Thanks for the tip on visisibilty.

What have you got the front page settings set to?  If you changed this to "Go directly to forum index" then it will show the forum on the front page.  I would reset the front page settings back how they were. Build / recreate your home page using portal front page to you're liking and add the content there.

ColinJM

@lurkalot - I have TinyPortal Edenliving TP admin ► Settings set to Redirect to forum. As I said previously, I fully intend to delve into and use TP properly as an "internal CMS" but want to point to an external website as a more image driven GUI in the meantime.
Kind Regards

Colin

@rjen

There is NO functionality in Tiny Portal to auto direct users outside the forum or homepage after logging in.
Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

ColinJM

#3598
[quote author=@rjen link=msg=4170022 date=1708156058]
There is NO functionality in Tiny Portal to auto direct users outside the forum or homepage after logging in.
[/quote]

Ah yes, that's what I thought - thankyou for confirming that @rjen
Kind Regards

Colin

lurkalot

Quote from: ColinJM on February 17, 2024, 02:40:54 AM@lurkalot - I have TinyPortal Edenliving TP admin ► Settings set to Redirect to forum. As I said previously, I fully intend to delve into and use TP properly as an "internal CMS" but want to point to an external website as a more image driven GUI in the meantime.


The idea of a portal is to use that to build your front page.  I have no idea what your existing landing page contains, but you can probably recreate that in a portal front page which will then become your landing page.

Advertisement: