Installing Quick Calendar

Installing the quick calendar is easy. Follow the steps below:

  1. Make sure your have LAMP running.
  2. If using PHP 4, need to have magic_quote off. Check that the php directive short_open_tag is 1 (editable via php.ini or .htaccess). The phpinfo() function reveals all your settings.
  3. Download the source code from here
  4. Unzip the downloaded code into a directory of your choice.
  5. Rename config.bak.php to config.php. Configure config.php with the right db and path details.
  6. There should be a sql file in the dowloaded code. Run the sql in your server to create the sample tables and data. You can of course empty the tables and populate with new data later.
  7. Lets try to insert a ‘small’ calendar. Paste the following code into the page where you want your calendar to appear:
  8. <?php
    require_once('path_to/controller.php');
    $cssCalendar= 'float:left;margin-right:30px;';
    $cssLongDesc='float:left;margin-left:50px;width:400px';
    // configure calendar theme
    initQCalendar('small','qCalendarSmall', $cssCalendar, 'myContentSmall', $cssLongDesc, 0,0,0,0,0);
    ?>

    make sure the 'path_to' is the system path to your quick calendar directory.

  9. If you want to customise the calendar, you need to have the right parameters for the initQCalendar() function depending on the theme you choose:

  10. initQCalendar(theme, divCalendar, calendarCss, divLongDesc, longDescCss, day, month, year, category_id, ajax)

    where

    'theme': name of the theme you want to use. It is the directory name under the themes directory.

    'divCalendar': name of the div you want to use to wrap around the calendar.

    'calendarCSS': CSS for DivCalendar above.

    'divLongDesc': name of the div where you want the long description to populate. This can be a new div or an existing one in the page. If it is a new div, you need to create one as shown in the sample above.

    'longDescCss': CSS for the Long Description.

    'day': current day. Leave 0 as the default.

    'month': current month. Leave 0 as the default.

    'year': current year. Leave 0 as the default.

    'category_id': 0 means show all categories.

    'ajax': Determines if this is an ajax call or not. Leave 0 as the default.

  11. That’s it. The best way to learn is to look at the demos. Duplicate the theme in the demo and play around.

Author: bpeh

Bernard Peh is a great passioner of web technologies and one of the co-founder of Sitecritic.net Website Design and Reviews. He works with experienced web designers and developers everyday, developing and designing commercial websites. He specialises mainly in SEO and PHP programming.

72 thoughts on “Installing Quick Calendar”

  1. In your installation instructions there is file required in the root folder init.php. That file was not included in the download. Is there something I am missing?

    jon

  2. Looks great, but there is no init.php on the .zip download. Should we rename some other file or something? (sorry for this noob question)

  3. I’ve just updated the installation text… Yes, the init.php has been renamed to controller.php. You can copy the demo code to your live file.

  4. Hey,

    Thanks for this app! it looks great!

    I just installed it as per the instructions, however the javascript doesn’t seem to be working. Nothing happens when I click the next/previous links. I tried in FireFox and IE..any ideas?

  5. I had the same problem Laurie. All you have to do is do a find/replace on <?= and change it to <?php echo on the phtml files and on the controller.php and it works a treat.

  6. tks cookie for the tip. yes laurie, can you check if you have the php directive short_open_tag set to 1 (done via php.ini or .htaccess). It should be 1 by default but some host turn it off.

  7. Thanks for the calendar 🙂

    Anyway to put the div with addition info always visible by default and change the content only when mouseover another links?

    Thanks

  8. I get this error: Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /var/www/qcalendar/controller.php on line 95

    When I try to include the stuff into a page.

  9. hi daniel, did you download the sql included in the download? did you configure config.php with the right mysql details?

  10. First of all this is gr8!!
    thank u for creating this calendar!

    but i have some major problem!

    Notice: Use of undefined constant QCALENDAR_SYS_PATH – assumed ‘QCALENDAR_SYS_PATH’ in *………..*\html\qcalendar\controller.php on line 25

    Warning: require_once(./config.php) [function.require-once]: failed to open stream: No such file or directory in *———–*\html\qcalendar\controller.php on line 26

    any help!

  11. hi again.
    i’m facing a huge problem!

    answering ur question yes i did
    i’m using IIS first to test locally before uploading.
    I installed the DB in my mysql engine

    here is the problem!
    code:
    define(QCALENDAR_WEB_PATH,’http://localhost/greenfields/html/qcalendar’);

    i tried

    define(‘QCALENDAR_WEB_PATH’,’http://localhost/greenfields/html/qcalendar’);

    it worked but no css!! there is no style in the calendar
    i tried to do it manually!
    i faced another problem
    i realized that the date won’t dispaly!(blank) the year and the month!
    i’m using ‘small’ theme

    plz help!

  12. hi genius,

    for this part:

    define(QCALENDAR_WEB_PATH,’http://localhost/greenfields/html/qcalendar’);

    If you see the config.php,

    it should be something like this

    // CONFIGURE WEB LOCATION FROM ROOT
    define(QCALENDAR_WEB_PATH,’/qcalendar’);

    where

    /qcalendar is the web location from “document root”

  13. For the uninitiated this distribution is a Gordian Knot. I am jealous of those who have their calendars working.

    Apart from the cong.bak.php, I have a collection of PHP files, text files and folders all with numbers in parentheses. The text files are mostly information – license, e-mail, etc. The folders have a JavaScript file, themes, some other PHP files related to updates and, at the root of the installation there are five more config.php files with numbers in the filenames, i.e config(14).php.

    There is no init.php nor controller.php anywhere to be found.

    I am working with an XAMPP installation on a Windows XP sp3 laptop.

    Please expand and clarify.

  14. This seems like a really useful application but I’m struggling to get it working. My problem is there is no CSS. I’ve read the above post, but couldn’t understand them. I’m using mac os x and have installed everything locally. Please help.

  15. Ignore last post. I was being stupid. Got css working. However, still not fully operational eg if I click on next month nothing happens…

  16. Please could someone help. I have the calendar displaying correctly, the long description is showing up as a tooltip, but none of the Ajax is working. I can’t change month or return to todays date.

  17. Hi there,
    I have two questions. I chose ‘complex’ in the init,
    initQCalendar(‘init’,’qCalendarSmall’, $cssCalendar, ‘myContentSmall’, $cssLongDesc, 0,0,0,0,0);

    and get two errors:
    require_once(/home/cpl/html/qcalendar/themes/complex/model/Calendar.php) [function.require-once]: failed to open stream

    I looked in the complex folder and the only thing in it is demo.php.

    Second question, is it possible to incorporate events that repeat every week?
    Right now I have to make an event every week, where as the week just repeats every tuesday.

    Thanks!
    MK

  18. Great tool, have done some modifications to pull events out of another data source.

    Would be useful to have a week start feature (unless it’s there and i’ve missed it) to be able to make it start on mondays rather than sundays.

  19. I’m having a similar error as others. Everything is setup and working correctly but, for some reason the events are not displaying.

    I can add events easily through the admin page and these are updated to the MySQL database correctly. The only problem is that when I display the calendar no events are shown.

    Please help.

  20. Okay, I solved this problem and thought I should post this as nobody else has offered up a solution.

    1) Each event must be assigned to a category. Choosing Category “All” does not seem to work.

    2) Leading zeros should not be present in the dates and will cause the SQL to not correctly find the dates.

    Hope this helps.

  21. when i try to use, this is happen
    Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\xampp\htdocs\SITES\demolaycataguases\templates\siteground\calendario\QCalendarBase.php on line 138

  22. Great little program, just need some cleanup here and their.
    I tried the demos standard and small they works great, but for some reason the tiny demo won’t work. It displayed with the links and looks good and clean without any javascript errors, but when clik on the links nothing happens. Are there any known problems or solutions?

  23. Great calendar thanks very much!

    I know I am duplicating an earlier post, but to get your style working, you need to edit the file called ‘config.php’ find the line that says:

    // CONFIGURE WEB LOCATION FROM ROOT
    define(QCALENDAR_WEB_PATH,’yourPathToCalendarHere’);

    Change yourPathToCalendarHere to the location that you have installed qCalendar relative to the file that you are running qCalendar from, for example. This is my structure:

    index.php // This is the file that, when run, has the calendar
    |__qCalendar // The dir that has the calendar config files

    So, I need to have the line:

    // CONFIGURE WEB LOCATION FROM ROOT
    define(QCALENDAR_WEB_PATH,’qCalendar’);

    If you are looking at the calendar from within the qCalendar folder, you need to have it like this:

    // CONFIGURE WEB LOCATION FROM ROOT
    define(QCALENDAR_WEB_PATH,’.’);

    Thanks again!

  24. Hi All,
    Trying to get this to work desperately but month and todays date aren’t showing. It’s not styled either.
    I’ve installed it locally into htdocs/qcalendar and altered config.php to:
    define(QCALENDAR_WEB_PATH,’/qcalendar’);
    but to no avail. Have setup DB and also an index.php file with:
    initQCalendar(‘small’,’qCalendarSmall’, $cssCalendar, ‘myContentSmall’, $cssLongDesc, 0,0,0,0,0);

    Would love to get this working. Any help is much appreciated!
    Many thanks

  25. For the demos to work properly on some PHP installations make sure to use “<?php echo” instead of “<?=”.

    Either that or enable short open tags within php.ini. Using short tags is discouraged when developing code meant for redistribution since short tags may not be supported on the target server. As in my case. Thank you for this application, it may prove useful.

  26. Thanks for the replies. I’ve changed all instances of <?= to <?php
    I sadly still don’t see the month or today is. They’re blank.

    Sorry! 🙁

  27. @jarvo

    The fact you’re seeing the calendar at all means you have short tags enabled, otherwise you’d just see the code as it was typed.

    Anyway, where is your index.php file located? in the htdocs folder, or htdocs/qcalendar folder?

    From what I can see in your config.php file, the index file should be in the htdocs folder.

    Hope that helps!

  28. I don’t know if anyone has already mentioned this, because I am too lazy to read all the comments.

    In config.php and controller.php all the names in all constant definitions should be in quotes: define(‘QCALENDAR_WEB_PATH’,’qcalendar’);
    Otherwise php displays annoying notices that the constants are undefined. That is if you have set error reporting level in the php.ini to display notices. It’s practically nothing but I thought it’s worth mentioning.

    Thanks for the great, awesome, super-duper calendar! I love it!

  29. Hi. Great calendar thanks.
    My prev/next links are not working.
    I’ve changed all <?= to <?php echo
    Any other ideas?
    Thanks

  30. Hey, is it possible to change the language of the calendar?
    I’d like to translate this calendar to portuguese!

  31. Hi i want to ask only one question. My firefox error console give me that error “displayQCalendar is not defined” and My prev/next links are not working. Please help me bpeh. “short_open_tag=1? and change all “<?php echo” instead of “<?=” like this file

  32. Ok guys, I finally got it to work.

    1. You’ve got to open longdesc.phtml and calendar.phtl with your preferred text editor, (I use Scite): http://i49.tinypic.com/29kxvt3.png

    2. Replace ALL!! the <?= into <?php echo:
    From this: http://i46.tinypic.com/2eq3mhh.png
    Into this: http://i45.tinypic.com/30m64o3.png

    (You have to do this for calendar.phtml, longdesc.html, config.php and controller.php)

    3. First extract your qCalendar.zip to htdocs/qCalendar:
    http://i45.tinypic.com/2nvs29w.png

    4. Then create your index.php file: (remember to change the path.
    http://i48.tinypic.com/2z9jxhv.png

    5. Save the index file in the htdocs directory
    http://i45.tinypic.com/2w2h56o.png

    6. Finished.

  33. hi there bpeh,

    i just found your calendar and it was great. Just what i needed.

    After downloading the .zip file, I have successfully created the database on phpmyadmin and place it on my rootfolder. But there are things that i don’t undersdand. Which files are needed to be edited? Is it only the config.php? and Which values will i be replacing on:
    1. define(‘QCALENDAR_WEB_PATH’,”);
    2. define(QCALENDAR_SYS_PATH, dirname(__FILE__));
    3. require_once(QCALENDAR_SYS_PATH.’/config.php’);
    4. define(QCALENDAR_TABLE,’qcalendar’);

    I placed the unzip folder in> “C:\wamp\www\ReservationSystem\qcalendarV2.5”
    and when running it on localhost here is the URL>
    “http://localhost/ReservationSystem/qcalendarV2.5/QCalendarBase.php”

    Please help me sir. I really need it. Thanks in advance and have a blessed day!!

    -singing_bee?

  34. Star,

    If you’re still trying to fix this, I had the same problem as you tonight. To fix it, in config.php, be sure that

    define(QCALENDAR_WEB_PATH,
    sets the path to the qcalendar directory *from your web root* (not document root as bpeh wrote elsewhere.) it has to be a relative, not absoulute, path.

    for example, if the absolute path is /home/myname/public_html/qcalendar, then
    define(QCALENDAR_WEB_PATH,’/qcalendar’);
    works; hope this helps.

Comments are closed.