Jump to content

Disposable Tools and Widgets Module Calling Widgets Anywhere?


FDC1601

Recommended Posts

Sorry, but I don't understand the "Call the widgets anywhere you want like you call/load others" on the README.

I installed Disposible Tools & Widgets but cannot figure out how to put any of the widgets into a page on my phpvms7 website.

Disposible Tools & Widgets seems to be installed as on  the "Online Readme"

Can I get an example of how to put TopPilots widget on a page?

 

Thanks,

 

Tim F., FDC1601 

Link to comment
Share on other sites

1 hour ago, FDC1601 said:

Sorry, but I don't understand the "Call the widgets anywhere you want like you call/load others" on the README.

I installed Disposible Tools & Widgets but cannot figure out how to put any of the widgets into a page on my phpvms7 website.

Disposible Tools & Widgets seems to be installed as on  the "Online Readme"

Can I get an example of how to put TopPilots widget on a page?

 

Thanks,

 

Tim F., FDC1601 

 

https://github.com/FatihKoz/DisposableTools#usage

This section gives the main usage of all available widgets provided by Disposable Tools. Also at the same readme there are detailed sub-sections for each widget.

 

https://github.com/FatihKoz/DisposableTools#top-pilots

 

So for example, if you want to use "TopPilots" widget at your home page, you need to do below items

 

1. Find the blade file responsible for the page you want to add the widget. Here in our example, imagine you want "Home" page so it is "home.blade.php" located directly under your theme folder.

2. Edit that file, pick a suitable location as you wish, then add it.

 

@widget('DisposableTools::TopPilots', ['type' => 'landingrate'])

 

3. Save the file.

I just copied the example usage syntax from the readme file.

 

If you want to adjust the widget options, then you need to follow the explanations provided in the readme. For example, you want to display not overall leaderboard but only last month, then you add relevant configuration options to the widget call

 

@widget('DisposableTools::TopPilots', ['type' => 'landingrate', 'period' => 'lastm'])

 

Also you may want to show top 10 pilots, then it would be

 

@widget('DisposableTools::TopPilots', ['type' => 'landingrate', 'period' => 'lastm', 'count' => 10])

 

Most of the time, people get confused with the "grid" design used by Bootstrap (the theme's core) and can not find the correct blade file ("blade" is a Laravel term).

 

All visible pages (the output) are called "blades" and they are stored under your theme folder (nicely organized). Everything related to dashboard is under dashboard folder, pages related to flights are under flights folder etc. etc.

 

If you need more info about Bootstrap and Laravel Blade, I would kindly suggest checking their official documents.

( Default theme uses Bootstrap 4.3 / Disposable Theme v2 uses Bootstrap 4.6 / phpvms v7 uses Laravel 8.x series )

 

If you are using Disposable Theme you can check it's home.blade.php as an example for how the "grid" system works and how the widgets are placed. Or you can check it from Github with below link

 

https://github.com/FatihKoz/DisposableTheme/blob/main/resources/views/layouts/Disposable_v2/home.blade.php#L33-L48

 

Hope this helps

Link to comment
Share on other sites

Most important things here are 

 

1. Finding the correct blade

2. Using the correct widget at the correct page with proper configuration.

 

Imagine you want to use some "airport" related widget like "Sunrise / Sunset" 

 

Then you need to place it a blade where you have some airport related information in hand.

 

@widget('DisposableTools::SunriseSunset', ['location' => $airport->id])

 

Why ? Because you need to provide it an airport's ID (4 Letter ICAO code). 

 

So placing that widget at your homepage will generate an error because there is no $airport (airport model as a variable) there. The error will say something like `unable to get property id of non object` and you will see `500 | Server Error` :(

 

However same widget, can be used at homepage with a fixed airport code. Then you will not get any errors but it will always show the same airport.

 

@widget('DisposableTools::SunriseSunset', ['location' => 'LIRF'])

 

In short, if you see something starting with $ in the readme, this means that "be careful when placing that widget" ;) 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...