PDA

View Full Version : Demo.php vs Index.php


KathrynBassett
11-22-2005, 07:11 PM
In another thread http://www.easyphpcalendar.com/forums/showthread.php?p=12198#post12198 I asked about the demo.php file. I was told that "if you'd check through the code in index.php, you'll see that all it does is check to make sure that this isn't the first time the calendar is used (a new setup) and that everything is running ok. Then it checks what you've chosen in the Setup Manager to see if you've disabled the display of demo.php. If you haven't then it includes demo.php and that's what it displays. You're not using demo.php directly, but you'll see that if you modify demo.php in any way, you'll see those changes by going to /calendar/"

I'm thoroughly confused about this. If I choose http://lacdcs.moonlink.net/calendar/demo.php it comes up the way I want. And if I choose http://lacdcs.moonlink.net/calendar/index.php it also looks right. However, if, in the setup manager, I choose to "Disable Demo: This will prevent users from viewing the index.php file in the main calendar directory." then go to http://lacdcs.moonlink.net/calendar/ without the specific php file, I see nothing. (It's enabled at present as it needs to be seen.

So, if the demo.php is disabled, then what is the purpose of index.php? Am I supposed to be making changes in index.php INSTEAD of demo.php? What happens if I do a copy of the contents of demo.php to replace the content of index.php. What is the purpose of being enabled vs disabled?

I'm sorry, but since php coding is brand new to me (I'm conversant with html coding), I'm finding the instructions at http://docs.easyphpcalendar.com/ to be not very user friendly for beginners. Has anyone written a step-by-step tutorial? Not for the initial installation which is fine, but for how to set up for other than the default, and to integrate a header, etc.

I'd also love to see a few links in this thread with examples of other people's customizations.

ve9gra
11-22-2005, 10:13 PM
Ok, since you're not new to HTML, you should understand that if you go to a directory instead of a specific file, your web server is going to try to feed you one of the index files (index.htm, .html, .php, etc...). That's why there's the index.php file there.

On the first time you run the calendar (after you've completed the upload procedure), the index.php file will detect that it has not been configured and suggest you run the Setup Manager to do so. After the calendar is initially configured, all the index.php file does is redirect you to the demo.php file which is there as an example to display some of the capabilities of the calendar and to give you an example of how to integrate the calendar script into exsting web pages.

If there was no index.php file, depending on your webserver installation, your server might display a file listing or a 404 error... and neither is desirable.

On the other hand, you might not want users to be able to go to /calendar/ and view the calendar. That's why the option is in the Setup Manager to disable the loading of demo.php from index.php. So that if a user goes to /calendar/ all they get is a blank page (not a 404 or a directory listing). It's "prettier" and might be considered a security feature.

Now, if you link directly to demo.php, even if it's disabled in the Setup Manager, it will still display. But since the demo.php file is more of a demonstration of what the calendar can do, and an example of what a properly formated file looks like, demo.php can be deleted after you're satisfied with the way you've integrated the calendar (as long as you're not using it of course).

For integrating it inside some of your own pages (like you're saying "integrate a header") make sure you read the Getting Started Guide (http://docs.easyphpcalendar.com/source/GettingStarted.htm) and also check out the "Integration" section of the Online Documentation (http://docs.easyphpcalendar.com/).

A quick way to understand what to do with those instructions is basically, create your own page with all your headers, and menus and all that fun stuff that follows the rest of your site design. Then follow the integration guide to add the little bits of code where you should (like in the <head> section, then right after the <body>, and then finally exactly where you want to show the calendar).

If you run into problems, we're here for that and we'll try to answer in the shortest delays.

[Some text in this post has been modified by Brian]

KathrynBassett
11-29-2005, 10:04 PM
All of the first part of your explanation was excellant in understanding the difference between the index and the demo. I've even tried an experiment (successful) - I copied demo.php to a new name called dcscalendar.php so that demo being overwritten is not a problem. Then in index, I changed that requirement to be dcscalendar instead of demo and it works.
http://lacdcs.moonlink.net/calendar/
I know it works because I only added that home page link in the new file.

It will be awhile before I can experiment with the integration for several reasons not important here. But I *will* get back to it. Thanks for the leads.