Page 1 of 1

Interactive view

Posted: 2020-01-05 17:06
by RonP
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

Re: Interactive view

Posted: 2020-01-21 06:12
by onoehring
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

Re: Interactive view

Posted: 2020-01-22 10:15
by RonP
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