Hi I have a dynamic website which is already online and it works great, but,I recently decided to add an event calendar and I have ran into some problems.

The website only uses 1 page and i then use URL variables to display content or include additional files. So i decided to carry on this way and include the calendar only when the calendar page is displayed.

The problem is that since the calendar also uses url variables whenever i change something on the calendar it loses the page url variable and therefore i return to the homepage.

Any ideas on what i could do to get around this?

Recommended Answers

All 5 Replies

Member Avatar for diafol

So let me get this right:

www.mysite.com/index.php?page=events

would show your events page (which may have your calendar on it)

so the calendar presents something like:

www.mysite.com/index.php?action=add&title=BBQ&date=20110201160000&content=lhwbow

OK, if so, yeah mashed.

Can I ask why you just want a single page? Seems a little odd to me. Something you don't want your users to know about or are you creating some sort of DIY template system?

The website is fairly small and uses a basic CMS so i decided 1 page was enough. The rest is as you say though, forgot to add that sorry.

So, when i access the calendar page it has an url like this:

mysite.com/index.php?page=calendar

but whenever i try and change something in the calendar it sends its own URl variable so i end up with:

mysite.com/index.php?cP=20

Which takes me back to the homepage so i dont know how i can make them work together. I need to change the way the page navigation works i think, i'm just not sure how.

Member Avatar for diafol

Lookwhy don't you just add '&page=calendar' to the end of the url for calendar form sends? Scroll through the forms in the calendar app. Add a hidden input:

<input type="hidden" value="calendar" name="page" id="page" />

This will work if the calendar form is sent by GET (I assume it is).

If calendar update is sent by link, e.g. delete an event (OK I have no idea how your calendar works), just tag on the "&page=calendar" to the end of the link. This bit may be buried in a javascript file somewhere - just search for something like '?cP='.

HOpe that was clear - I'm feeling a bit fuzzy.

Thanks i'll give that a go. I'm fairly new to php though and there are lots of files so i'm not sure that i can do it without breaking something.

Would it be possible to change the way the nav works though? changes made to the nav are easy as its only 1 page but i dont know any way of doing it other than url variables.

the calendar is the LuxSoft Event Calendar if you were wondering http://www.luxsoft.eu/

Member Avatar for diafol

Sorry pj - I won't be check the code from the link.

Usual nav would be to create separate files for each page:

index.php
calendar.php
about.php
contact.php
(etc)

like so...

<ul id="nav">
<li><a href="index.php" title="go to the homepage">home</a></li>
<li><a href="about.php" title="about me">about me</a></li>
...(etc)...
</ul>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.