PDA

View Full Version : Can we do this in the client side


chelvis
05-01-2003, 03:02 PM
In all of my web pages, I split the website into portions of xsl and then use the java to call these split portions to display the page. In this way I would only have one xsl regarding the logo area and one xls for the footer and maintainance is easy.

Now I am creating a new corporate web site for our company and my manager said since the company website doesnt have any functionality and only display, we can have these as flat html. But on my side if some one decide make a change to one page, then I have to go and put that change in all the 10 or 20... pages. Say now we have some links in the future they plan to add more to the navigation bar.

So is there any way just on the client side with javascript I can split these htmls in to portions and then call them back? If possible give me an example please?

beetle
05-01-2003, 04:09 PM
No, but I think you can do basic "templating" with SSI.

If you want a simple, dynamic header/content/footer type setup, I can give that to you with like 5-6 lines of PHP.

brothercake
05-01-2003, 04:34 PM
Yeah you can - you can import data from multiple XML docs and output the resultant transformation, all client side.

But I don't know how ...

beetle
05-01-2003, 04:40 PM
That's true bcake, but I think there's some browser issue there, as well as the whole idea of using javascript as a pseudo-CMS is generally a Bad Idea™

So, possible? yes.

Recommended? Not in the slightest.

chelvis
05-01-2003, 04:55 PM
Thanks guys. I dont want to do some thing which is not possible in some browsers. Becasue we have customers who still use some older browsers.

But that php thing, yeh it would be nice if you can give me some beetle? But I have no idea of php so could you please explain what I have to do with it?

beetle
05-01-2003, 05:00 PM
Well, before showing you any code, you'll need to know if

1) Your server already has PHP
2) if not, can you install it?

PHP is free, and a fairly easy setup, especially using an installer like firepages' phpdev (http://www.codingforums.com/showthread.php?s=&threadid=3992)

http://www.php.net

brothercake
05-01-2003, 05:22 PM
Oh well yeah - client-side XML is strictly IE6 and moz only; I figured you knew that since client-side XML is what you originally asked for.

chelvis
05-01-2003, 07:15 PM
Thanks beetle. Unfortunately our company dont support php and also we cant download it without the permission of our parent company. So I have to forget about this or I have to write a small java program and convince others.

brothercake
05-01-2003, 07:20 PM
How about .js archives? You could have like a "header.js" which contains document.write statements to create your global navigation.

Course the trouble with that is that it won't work for non-JS browsers.

What about SSI? Even a host which won't allow PHP is unlikely to have a problem with SSI because it doesn't have the potential to be dangerous.

beetle
05-01-2003, 07:23 PM
Didn't I day SSI? :p

I'd probably resort to global find/replace operations on static HTML files before using .js archives to document.write() data.

liorean
05-01-2003, 07:25 PM
Originally posted by brothercake
Oh well yeah - client-side XML is strictly IE6 and moz only; I figured you knew that since client-side XML is what you originally asked for.
Actually, it's Safari/Konqueror too. Apple needs to fix a few problems with porting expat (as an aside, Moz also uses expat for XML parsing) and then we'll see it in Safari too. (At least the DOM way - I don't know whether they intend to add XMLHTTPRequest and/or XMLSerializer support or not.)

And, If I'm not completely wrong, Opera will jump on the train before it leaves them behind. They have some problems with the DOM as it stands now already, though, so I'd say 8.0 or later.

chelvis
05-01-2003, 07:30 PM
Yes beetle you said about ssi but you asked me to check if the server support php:D

Now I am thinking of the .jsp but dont know yet what they would tell. SO let me wait and see.

beetle
05-01-2003, 07:44 PM
I was talking to brothercake ;)

.jsp? Don't be confused by .js archives and .jsp (Java Server Pagse) -- they are nowhere near the same thing.

brothercake
05-03-2003, 02:33 AM
Originally posted by liorean
Actually, it's Safari/Konqueror too. Apple needs to fix a few problems with porting expat (as an aside, Moz also uses expat for XML parsing) and then we'll see it in Safari too.
Excellent; that's one more notch :)