This topic is locked

Tips for Adjusting to Screen Size Automatically

8/18/2021 3:18:57 AM
PHPRunner General questions
D
Daviant author

Dear, I am making a web application, but I need it to behave like a Desktop application in its appearance when it is run on a pc. That is to say that it adjusts to the size of the monitor in its height and does not produce scrolling. Is it possible to do this in PhpRunner?

Thanks a lot
Google translator

HJB 8/18/2021

Proceed to "miscellaneous" section inside PHPRunner and limit the number
of records to be displayed under "Records per page". Further, you can change
the range options under "Records per page selection" according to your needs.

img alt

D
Daviant author 8/18/2021

Greetings HJB, thank you very much for your answer.
It's not exactly what I need, maybe I explained myself wrong.

What I want to do, if possible, is that when entering, for example, the list page, the display is adjusted to the size of the pc monitor. and that automatically determines the number of records to display based on the size of the monitor. Always keeping the page number section down at the edge of the monitor.
(Google translator)

HJB 8/18/2021

Page layout and Grid type

Search for "body width" (as seen within the screenshot of the above URL content) and
change it from "standard" to "full" = using full PC monitor width to display e.g. a list page.

M
mhango 8/19/2021
If you intend to use the dashboard, dont specify the width and height of the dashboard elements. That way, it will automatically resize according to screen size
D
Daviant author 8/19/2021

Thank you very much for your answers, but it is not exactly what I need. The alternatives they mention fit the monitor width perfectly, but what I need is to adjust the height (on PC) so that no scrolling occurs.

HJB 8/19/2021

Do NOT compare "apples with oranges" here ...

PHPRunner is a code generator for so called DYNAMIC WEB PAGES in junction with e.g. MySQL
or lots of other databases. In other words, it provides web applications where database content by
tables of whatsoever number of database records are displayed at a large. So, depending on the
numbers of users, some hundreds or even thousands of database records need to be displayed
over time, dynamically managed by an interactive web appliance created by PHPRunner.

If you have just 10 or 20 products to show on a single page with NO scroll bars at all, I recommend
to look around for a web page making tool which enables you to create STATIC WEB PAGES.

In shortage, for STATIC web pages you can define the page size that way to not see any scroll bar at all.

A
acpan 8/19/2021

if avoiding scrolling is important, such as in kiosk app, maybe you can detect the screen resolution after login at JS events, and make a ajax call to php script to update the resolution into user profile table, and subsequently PHP can retrieve at before SQL event and limit the rows to be displayed.

JavaScript to detect screen size: read this

D
Daviant author 8/20/2021

Thanks acpan for your answer. I will continue investigating the side that you indicate to me. I have managed to solve problems that were impossible for me with your help.

I think HJB didn't understand what I want to do. Nor have I compared anything. I am working with PHP, MySQL and SQL Server and the tables do not have 10 or twenty records, they have thousands. But queries can be optimized so that the system responds quickly.

Thanks a lot.

Google translator

HJB 8/20/2021

As registered PHPRunner user since v1.0 in 2001 I'm seeing NO
scroll bar at my end on a dummy project under PHP 8.09 once I
limit the records to 4 per page (as I tried to explain on how to
do it as above).

I do NOT have any objections if others want to ride the PHPRunner
horse from for example "underneath the animal" riding position by trying
to clamp hands and feet into the horse's skin, hairs and flesh by means
of experimental manual coding yet as far as I'm concerned, I only want
to ride that very horse from the top position, firmly saddled by what the
developers had been implementing before 2 decades experience gained.

Just my two little cents on the issue ...

D
Daviant author 8/20/2021

Each one has its needs and requirements and each project is different. And not because a certain project requires something is wrong. If a query seems wrong to you, just do not answer and we avoid all problems. For what I'm doing PHPrunner is perfect.

A
acpan 8/20/2021

Maybe this can give you some idea.

I had implemented below with good result to dynamically "do_something", based on detected user's screen height:

Part 1 : Detect User Screen with JS

Javascript On Load event at login page, insert this:

// Get the total height and width of your screen in pixel:
var h = screen.height, w = screen.width;
ajax_call_to_update_user_profile_table(h,w);
A
acpan 8/20/2021

Part 2: PHP part to display rows per page based on screen height

PHPRunner event - AfterTableInit - allows you to set rows per page (pageSize) for the specific table conditionally:

AfterTableInit event:

// replace <tableName> with your table name
if ($_SESSION["screen_height"] < 600 ) {
$tdata<tableName>[".pageSize"] = 5;
} else {
$tdata<tableName>[".pageSize"] = 10;
}

Note: $_SESSION["screen_height"] is the session variable you would assign from user profile table at login successful event.

More info on AfterTableInit event and setting Page Size

A
acpan 8/21/2021

Detecting screen width can also be done too, it's a reliable and good way to tell if user is a mobile device, by obtaining its screen size via JS, and hence possible to save the value into user profile table for PHP to use.

Go to this link, then open the chrome console and set the viewing device to mobile, click try it and see the width value changes.

img alt

D
Daviant author 8/21/2021

Thank you very much Acpan for your time and patience. With the information you provide me, I should already achieve the results I need. I'm going to do the corresponding tests.
Thank you very much again ...

(Google translator)