Cannot creat a public version

Cannot creat a public version

Postby mac » Wed Apr 09, 2008 4:33 pm

Hi Chris

Great script but im just having trouble figuring out how to make a 'public' version of the calendar too so that visitors cannot change availability dates too. Ive been through the forum and the readme files but it doesnt explain how to create a public version of the calendar too. Its obviously possible as i have seen on your example websites but im just too stupid to figure it out?!

Can you help?!

Cheers :)
Posts: 1
Joined: Wed Apr 09, 2008 4:24 pm

Re: Cannot creat a public version

Postby chris » Wed Apr 09, 2008 4:44 pm

Hi there mac and welcome to the forum :)

You are right, the documentation is lacking :( bit by bit I am trying to improve this script, not only in the way it works but also in the way it is "packaged" so this is something I will have to add to the instructions file.

It is actually rather simple, hopefully you will have spotted the call to the function that actually draws the calendar: "draw_cal()"
This requires several variables, the last one of which is the "editable state" of the calendar - this can either be "1" - ie editable or "0" - non-editable.

Calendar in edit mode:
Code: Select all
draw_cal(ID_ITEM,$val["month"], $val["year"], $booked_days,1)

Calendar in "public" mode:
Code: Select all
draw_cal(ID_ITEM,$val["month"], $val["year"], $booked_days,0)

You will have to either create a copy of the calendar with this value modified for "public viewing" or control this variable by some kind of admin restricted control.

I hope this answers your question - let me know how it goes ;)

User avatar
Site Admin
Posts: 1089
Joined: Mon Dec 17, 2007 7:42 pm
Location: Málaga, Spain

Re: Cannot creat a public version

Postby byronyasgur » Sat Jul 05, 2008 3:37 pm

chris - i just thought that this page on it's own would be pretty much enough information for many people if you made it a sticky

My own experience

following chris's instructions on this page, I:
    created a new page calendar.php in the same directory as the editable page and copied the contents of the editable page onto it

    did a search for draw_cal

    changed it's last value to 0

    changed the form action attribute to calendar.php
that's it - working front end public page - i havent done extensive testing but it seems fine i can change the backend and the public can only view but not make changes
Posts: 6
Joined: Thu Apr 24, 2008 3:53 am

Return to General

Who is online

Users browsing this forum: No registered users and 2 guests