Jump to content


AJAX "dynamic windows" in application form - need clarification


2 replies to this topic

#1 concrete_mielie

    Young Padawan

  • Members
  • Pip
  • 2 posts

Posted 04 May 2007 - 02:29 AM

Hi there all, first post ... yay! :biggrin:

Alright, to my problem. Firstly, I have read and tinkered with AJAX and I find it quite amazing and wonderful and so I have set about using it for my web admin system. I realise that my question is quite broad and that fragments of it are answered already but it'll be best if i just ask anyway for the complete answer. So hopefully someone can help me to understand what the right approach is here. Questions that I have whilst explaining will be bolded. Also, please bear with me since I am new to AJAX and it's possibilities and implimentations...hence these might be very stupid questions.

At the moment, I have a frame-based system (i know i can make it non frame-based ... i will if i have to) with a header, main and footer page. 'header' contains the buttons to load the 'applications', and 'main' contains the 'desktop' - this is called AdminPage and it's a PHP file.

At the moment, since I have just started creating this system, there is only a login window which appears in AdminPage. I do this essentially using a PHP 'include' to call the 'application' into a layer, and it is essentially is just another HTML page being included. Something along the lines of:

<body class="bodyMain">
<?php

// If we're not logged in, display login form
if ($LoggedIn != 1) {

    ApplicationLoad("Login");

} else {
	    // load other applications??
}

?>
</body>

The problem, as I understand it, is that this login thing is hard-coded to appear in my PHP based on whether a login session is set or not. While this is technically correct, the issue comes later ... when I click on (for example) the 'My Applications' button ... a new window (or application ... or div with include) should appear, while retaining the old ones. Simple dynamic windows. But how can this be achieved when PHP is mostly involved?

Basically what I need is the ability to create infinite new 'windows' client-side, without refreshing AdminPage.php - I know that this is possible on a pure HTML level (click on the form button and a new window gets created) but is it possible with a whole lot of PHP and calls to databases? Do i need to use XML to carry information?

I use prototype.js with scriptaculous.

I realise the actual question is kindof vague, but my understanding here is kindof muddled and I don't want to code everything with PHP functions and waste time. I do hope that my post is understandable and that someone can help me. I am willing to send a ZIP of the overall code and a SQL dump on a private message basis.

Thanks in advance! :P

#2 Demonslay

    P2L Jedi

  • Members
  • PipPipPip
  • 970 posts
  • Gender:Male
  • Location:A strange world where water falls out of the sky... for no reason.
  • Interests:Graphic Design, Coding, Splinter Cell, Cats

Posted 04 May 2007 - 03:27 PM

Do you fully understand how AJAX works?

Anything you can do with PHP, you can simply echo it and send it back through the stream for the AJAX call to grab and do with what it needs.

#3 concrete_mielie

    Young Padawan

  • Members
  • Pip
  • 2 posts

Posted 07 May 2007 - 09:00 AM

View PostDemonslay, on May 4 2007, 10:27 PM, said:

Do you fully understand how AJAX works?

Anything you can do with PHP, you can simply echo it and send it back through the stream for the AJAX call to grab and do with what it needs.

Yeah, I do understand how it works ... for the most part. I know that it can echo through the stream. I also admit that my knowledge of the whole thing is not yet quite where it should be considering my undertaking. However, I like to work like this - use a difficult challenge to teach myself how to acheive the task ... it's how i taught myself PHP when i created my first content management system - then improved it - and now i'm moving to version 3. :D So bear with me!

Okay, so the point is, i have to DYNAMICALLY create elements (i.e. a div) and populate it with code ... using PHP ... and this code also contains javascript (which seems to cause problems when using .innerHTML methods.) These dynamic 'windows' are being created on a single page...but there can be an infinite number of new windows opening!

Essentially, i think that the problem is rooted on the server-side-client-side relationship...because I kinda need to pass javascript variables to PHP to make it work at the moment ... there has to be a way!! :(

I have managed to create a method for creating new DIV's ... that is fairly easy. Loading content into the Div's is fine - except that the file that i am PHP-including (which is part of the problem - i know - i use a PHP script to handle the include at the moment ... which is something i suspect I will have to change) will not display correctly because the link to the CSS is incorrect and any javascript that is in there seems to cause problems (although this isn't verified yet.)

Let me abstract here and ask a broad question. Imagine Microsoft Windows. Now, is it possible to create a totally web-based desktop system, with movable icons which ... when clicked on ... open applications which can take and lose focus and be moved around, resized and refreshed ... all this without having the main page of the site refresh? As far as I know, the answer is yes. and i could definately do it if it was simpler, with windows that start open ... but what if there can be any combination of windows open at any time?

Think of this much in the same way as an MDI application like Photoshop. You can have multiple documents open, as well as various pallettes and toolboxes, all contained in the program. That's what I want to create, just in web-based form. Can this all be done without a page refresh??

Does anyone have any experience in the possible implications of using LOADS of sessions to store application data and then forcing a page refresh upon opening a new application (from within the application i can do an innerHTML to not have problems with a refresh THERE, but that's not a problem because it's a contained environment with it's own limitations.

Or do i need to stream the whole 'desktop' page? See, in implimentations that i've seen of AJAX, it's usage has been minimal - i.e. a small feed window ... or a dynamic image gallery ... or a weather thingie that pops up when you do something. I've also seen Web 2.0 applications like the new Yahoo mail. In itself, this is really great and it is something like what i want to do. *sighs* lol

Do you understand my task and my problem? I hope so, it's kinda difficult to to articulate exactly waht i'm trying to say.

I also realise it's a pretty big task that i'm trying to acheive. :)

Am I just being silly?





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users