Interactive view

Topics related to AppGini plugins/add-ons go here.
Post Reply
User avatar
RonP
Veteran Member
Posts: 219
Joined: 2013-08-27 13:36
Location: Heiloo, The Netherlands
Contact:

Interactive view

Post by RonP » 2020-01-05 17:06

Hi,
I have a view that gives me the records of MONTH(`CreationDate`)= MONTH(NOW())

Is it possible to make this "interactive" when the View is started?
So I would start the <viewname> = <interactive.....this will be the number of a month> or so

Ron

User avatar
onoehring
AppGini Super Hero
AppGini Super Hero
Posts: 1156
Joined: 2019-05-21 22:42
Location: Germany
Contact:

Re: Interactive view

Post by onoehring » 2020-01-21 06:12

Hi Ron,

maybe use the hooks folder for this?
You might use the already existing your existing view and add an extra WHERE to it using the

Code: Select all

$options->QueryWhere = 
(search forum: search.php?keywords=querywhere )
argument. So add your dynamic month to that. You can grab the month from a dropdown of your page with something like this

Code: Select all

//number of month
$criteria_month = isset($_GET['month']) ? makeSafe($_GET['month']) : date('n');
when you have a dropdown like this

Code: Select all

<label for="month">Month: </label>
<select id="month" name="ziel" class="input-sm">
	<option value="1">January</option>
	...
	<option value="12">December</option>
</select>
where you can add a "selected" using php to the current month.

or, alternatively you can simply add ?month=5 to your URL when opening the view.

Another way I am sometimes working when I need to use a custom (long) SQL for view only, is to define my SQL completely in the custom (!) code of the page.

Olaf

User avatar
RonP
Veteran Member
Posts: 219
Joined: 2013-08-27 13:36
Location: Heiloo, The Netherlands
Contact:

Re: Interactive view

Post by RonP » 2020-01-22 10:15

Hi Olaf,
Thank you for answering.
I'm not that familiar with PHP, however I'll look into your given link to the forum.

Thanks so far.
Ron

Post Reply