| View previous topic :: View next topic |
| Author |
Message |
adawson
Joined: 02 Jun 2008 Posts: 85
|
Posted: Fri Jun 13, 2008 8:38 am Post subject: Adding Search box and category menu? |
|
|
| In the standard, untweaked calendar, the sidenav offers a search box and the ability to select events by category. How can I add this functionality to an embedded calendar? |
|
| Back to top |
|
 |
esoft_ian
Joined: 12 Sep 2005 Posts: 5275
|
Posted: Fri Jun 13, 2008 4:31 pm Post subject: |
|
|
| Adding a search box and code for a search is going to get complicated. With all that you want to do, you may want to consider customizing a theme and index.php rather than trying to re-write everything into another PHP page. Would that be a viable solution for you? |
|
| Back to top |
|
 |
adawson
Joined: 02 Jun 2008 Posts: 85
|
Posted: Fri Jun 13, 2008 7:58 pm Post subject: |
|
|
It's not out of the question, but there will still be some things that need to be customized. And at this point I'm almost done with the calendar except for a couple of functions such as this.
A search box would be a good function to have but not a necessary one. On the other hand, adding the select category is necessary. I've been able to create it in Joomla Studio, but I'm not having any luck using the Joomla generated code. I assume whatever is preventing me from previewing in Joomla or viewing using direct URLS is also causing havoc with the code it generates. And my timeline is such that I can't troubleshoot Joomla when I can get the same result with Calendar publisher, some tweaking and Dreamweaver. |
|
| Back to top |
|
 |
esoft_ian
Joined: 12 Sep 2005 Posts: 5275
|
Posted: Mon Jun 16, 2008 4:12 pm Post subject: |
|
|
Anywhere in your page after the $cal object is created and $cal->set("calendar", ...); is called, you should be able to do something like this:
| Code: |
if($_REQUEST['category']) $cal->set("category", $_REQUEST['category']);
require_once(constant("_CAL_BASE_PATH_") ."include/classes/class.form.php");
# CREATE FORM OBJECT
##########################
$_cal_form = new _cal_form();
# SET FORM DEFAULTS
######################
$_cal_form->defaults['category'] = $cal->event_types;
echo($_cal_form->select('category', $cal->get_categories(),
"onChange=\'this.form.submit()\'"));
$_cal_form->print_footer();
|
|
|
| Back to top |
|
 |
adawson
Joined: 02 Jun 2008 Posts: 85
|
Posted: Tue Jun 17, 2008 5:39 pm Post subject: |
|
|
| This does add a drop down box with the categories, but it doesn't work. Selecting one doesn't change anything. |
|
| Back to top |
|
 |
esoft_ian
Joined: 12 Sep 2005 Posts: 5275
|
Posted: Tue Jun 17, 2008 5:49 pm Post subject: |
|
|
Hi,
Make sure that this:
[cdoe]
if($_REQUEST['category']) $cal->set("category", $_REQUEST['category']);
[/code]
is before any line containing $cal->display_...().
Let me know if this doesn't resolve it. |
|
| Back to top |
|
 |
adawson
Joined: 02 Jun 2008 Posts: 85
|
Posted: Tue Jun 17, 2008 6:23 pm Post subject: |
|
|
I did both this:
| Code: |
<?php
if($_REQUEST['category']) $cal->set("category", $_REQUEST['category']);
?>
<?php
$cal->display_month();
?>
|
and this:
| Code: |
<?php
if($_REQUEST['category']) $cal->set("category", $_REQUEST['category']);
$cal->display_month();
?>
|
Neither is working |
|
| Back to top |
|
 |
esoft_ian
Joined: 12 Sep 2005 Posts: 5275
|
Posted: Tue Jun 17, 2008 6:50 pm Post subject: |
|
|
Sorry. Change this line:
| Code: |
echo($_cal_form->select('category', $cal->get_categories(),
"onChange=\'this.form.submit()\'")); |
... to this ...
| Code: |
echo($_cal_form->select('category', $cal->get_categories(),
"onChange='this.form.submit()'")); |
|
|
| Back to top |
|
 |
adawson
Joined: 02 Jun 2008 Posts: 85
|
Posted: Fri Jun 20, 2008 7:45 pm Post subject: |
|
|
| Nope. Still nothing. Just the dropdown. |
|
| Back to top |
|
 |
adawson
Joined: 02 Jun 2008 Posts: 85
|
Posted: Sun Jun 22, 2008 4:26 am Post subject: |
|
|
| esoft_ian wrote: |
| Adding a search box and code for a search is going to get complicated. With all that you want to do, you may want to consider customizing a theme and index.php rather than trying to re-write everything into another PHP page. Would that be a viable solution for you? |
If I went with this option, how could I get the events to display in my customized event view rather than in default one? |
|
| Back to top |
|
 |
adawson
Joined: 02 Jun 2008 Posts: 85
|
Posted: Sun Jun 22, 2008 10:40 pm Post subject: |
|
|
| Nevermind. I've been able to do this. |
|
| Back to top |
|
 |
|