The Cache: Technology Expert's Forum
 
*
Welcome, Guest. Please login or register. September 23, 2019, 10:22:59 AM

Login with username, password and session length


Pages: [1]
  Print  
Author Topic: philisophical discussion about XML XSL and PHP as a methodology  (Read 3639 times)
nutballs
Administrator
Lifer
*****
Offline Offline

Posts: 5627


Back in my day we had 9 planets


View Profile
« on: June 17, 2008, 05:29:55 PM »

As most of you know, I do bad things on the internets. OK, not that bad, but annoying maybe...

Anyhoo. I built my system out of duct tape, bailing wire, and voodoo, but along the way, I think I have come up with a very loose architecture for probably all my future projects. So, partly as a gut check, and partly as a point of something to argue about on here, I wonder what opinions are on a setup using XML XSL and PHP.

The short version is using an XSL template, which is processed by php using XSLTransform.

The beauty of this is that you can completely remove the design aspect from the programming aspect. This is a good thing in my book. It means that even if you need to do a custom crazy ass thing in the middle of the page, which the XSL cant actually do for some technical reason, then you can just do a PHP call from within the XSL, and viola, your crazy ass thing is now displayed.

On top of that, you can more easily manage your site design, since you could do something as straightforward as designing 1 XSL per page, or get smarter about it and embed other XSLs like a header and footer. Technically you can make just 1 big ass XSL for every page in your application, and just switch on or off the parts you need for that page.

Using the native XSL scripting, you can loop through rows of data, displaying what you need.
OR
You can write a custom PHP function, that gets called and produces the output to the page much like the traditional PHP webpage approach.

So I ask, what are the downsides to this methodology? It seems easy to manage. Easy to wrap your head around. And clean from a coding point. The only downside I can think of is the speed of the XSL transformation, which I really know nothing about. Being that hardware is cheap, does the speed decrease that XSL might cause, justify not using it for ease of management and design?

Also, I assume that there is no issue with AJAX, since afterall, the XSL is processed serverside and spit out as HTML. After that initial spit, everything functions the same way as a traditional AJAX system would.
Logged

I could eat a bowl of Alphabet Soup and shit a better argument than that.
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #1 on: June 17, 2008, 05:38:38 PM »

I don't know enough about XSL to comment intelligently, except for a rather standard answer - in a vast many sites that you produce I think it's cool because the data can be the same and the look can be completely different. Abstracting the GUI from the data is essentially a good thing. Virtually everything I do is incredibly boutique, so this actually adds another layer of complexity I must work around rather than just getting the page out.

Essentially though, I think you and I see the world from a similar perspective, and I cannot find anything major about the thought process that I don't like. I'd actually love to see where you go with it, since I know so little about it I'll bet that your experience will be invaluable here.
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
nutballs
Administrator
Lifer
*****
Offline Offline

Posts: 5627


Back in my day we had 9 planets


View Profile
« Reply #2 on: June 17, 2008, 07:28:27 PM »

interestingly I thought the same thing as well at first. But then because of my current tube-clogging-expedition, I decided to dip my toes in. The realization is customization, without touching php. Realize though (im sure you do) that my tube-clogging is purely for shits and giggles, and is not my programming focus at all. I have very focused apps, which serve very specific purposes, mostly even only on the backend. A lot of my stuff never even is seen by the public. Yet, i still have the feeling this would be good for my projects, since I can consolidate the display into 1 XSL file, or a bunch of little XSLs that all include as needed. The "hey can you move that over there" iterations seem like they would be a bit less annoying using XSL.

As long as all your display data is translated into XML (you dont have to technically, but might as well keep conventions), you can then create a XSL for browser, for spider, for iPhone... Though I am not certain of the interplay with AJAX style apps. Of course you can do it without XSL, but to be able to create a custom display for a specific device, without having to do any PHP other than adding a agent switch, is kind of neat and potentially powerful.

But the real kicker for me was the fact that its basically HTML with some extras. I like that.

I have not put this into practice though for anything complicated yet, so I really dont know what corners I will end up painting myself into. But in my experience so far, I dont see any.
Logged

I could eat a bowl of Alphabet Soup and shit a better argument than that.
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #3 on: June 17, 2008, 08:53:26 PM »

I'd really like to see your work when you get something worth posting. I'd imagine that many of my retail sites could benefit - although I'm concerned about the amount of JS and interactivity that can happen in my "detail and add to cart" pages... but again, all that said, I'm certainly not the only one that would appreciate it if you could school us a bit when you feelz like aschoolin.
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
DangerMouse
Expert
****
Offline Offline

Posts: 244



View Profile
« Reply #4 on: June 18, 2008, 01:24:10 AM »

We're you thinking of parsing the XSL server side or client side Nuts? It would be great to do it client side but I'm not sure of browser compatibility issues and tbh when I looked into doing this I was a bit worried about providing nice XML structure data to be scraped by all and sundry!

Ultimately this approach is what XHTML standard is all about - modularised design combined with schema and xsl files, but sadly lack of proper browser support turned it into the finicky version of HTML it is today.

Anyways, personally I think its a great idea and something I plan to implement. I'm currently learning to implement MVC practices and think XSL is a perfect fit to help avoid HTML in the View layer - the only bit that bothers me is the overhead in creating an XML document and then passing it to an XSL parser before output - havent investigated caching options yet. Plus it could be seen as over engineering in a way, the markup that you'd use to generate the XML will ultimately just be an arbitary version of HTML in many cases e.g. you'll still need <title>. However that said, for rendering to multiple devices and the fact it creates near total separation of concerns and personally I think its worth it.

DM

PS - take these comments with a huge pinch of salt as I've yet to get around to deploying a full dynamic website! (I have a big problem in finishing projects lol)
Logged
nutballs
Administrator
Lifer
*****
Offline Offline

Posts: 5627


Back in my day we had 9 planets


View Profile
« Reply #5 on: June 18, 2008, 06:25:07 AM »

DM, i went down the same path as well. some Search engines also dont play well with XML/XSL client side, though the important ones do from what I can tell. I agree the browsers arent there yet. It will be good when they are. 1 data document, infinite display documents... Google could be so much prettier, or so much more streamlined for example, though that will never happen because of the ads. And thats part of the reason it will never get adopted by money makers. I wouldnt want my site going out to the client, with the ability for them to change what is displayed. CSS only can change how it looks really, but XML/XSL, the client could technically do anything they want with it, and important info or money making elements could be removed. bad...

I am actually talking about Server Side parsing and transformation of the XML and XSL documents. Perks hint at a suggestion that I do a small tutorial is a good idea. I will do that in the next few days. Short and to the point, but it will show why i am starting to like it lots. So that should give you an overview, and help you decide if you should dig further. I have a feeling it will be worth some discussion because the potential is pretty decent. The pitfalls are just not availing themselves to me yet.
Logged

I could eat a bowl of Alphabet Soup and shit a better argument than that.
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #6 on: June 18, 2008, 09:46:55 AM »

Sweet. Looking forward to that because it sort of makes my brain hurt.
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
DangerMouse
Expert
****
Offline Offline

Posts: 244



View Profile
« Reply #7 on: June 18, 2008, 12:18:10 PM »

 Ditto Looking forward to seeing what you come up with. I've read a bit about server side processing libs etc but never got around to testing them out, same as I've dabbled with XSL but not done anything major. Should be quite good though as I believe it uses alot of XPath which, personally, I find quite good.
 
DM
Logged
dink
Expert
****
Offline Offline

Posts: 349


View Profile
« Reply #8 on: June 18, 2008, 06:16:50 PM »

Bring it on Nuts.  I love learning new stuffs.
Logged

[quote Nutballs]
the universe has a giant fist, and its got enough whoop ass for everyone.
[/quote]
Bompa
Administrator
Lifer
*****
Offline Offline

Posts: 564


Where does this show?


View Profile
« Reply #9 on: June 19, 2008, 05:52:11 AM »

to be or not to be

crap, i thought we were gonna talk philosophee

instead i just see acronyms i dont understand


 Vomit
Logged

"The most beautiful and profound emotion we can experience is the sensation of the mystical..." - Albert Einstein
nutballs
Administrator
Lifer
*****
Offline Offline

Posts: 5627


Back in my day we had 9 planets


View Profile
« Reply #10 on: July 01, 2008, 07:04:43 PM »

bah this is gonna be a ways off. I got distracted with a new toy...
http://www.perkiset.org/forum/freemem_garbage_collection/expression_engine_anyone_use_it-t1029.0.html

it might actually result in me changing my methodology. lol
Logged

I could eat a bowl of Alphabet Soup and shit a better argument than that.
Pages: [1]
  Print  
 
Jump to:  

Perkiset's Place Home   Best of The Cache   phpMyIDE: MySQL Stored Procedures, Functions & Triggers
Politics @ Perkiset's   Pinkhat's Perspective   
cache
mart
coder
programmers
ajax
php
javascript
Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks


Valid XHTML 1.0! Valid CSS!