Web 2.0 Recipes With PHP + DHTML 134
An anonymous reader writes "Take a look at these full simple code examples for dynamic elements for your web apps, including: Ad boxes, Pop-ups, Spinners, and Tabs. Easy ways to show and hide content on the page." From the article: "Incorporating JavaScript into your page makes the page dynamic and creates a more compelling user experience. Users can get more data more quickly, look at information from different aspects, and seamlessly navigate the site -- and the site doesn't have to go back to the server for lots of pages. However, there's also a reason to avoid using JavaScript: browser compatibility. In the early days of flat HTML, Internet Explorer rendered pages differently from Netscape. Those problems were fixed, but when support for CSS was added, new compatibility issues arose. Now most of the CSS issues have been solved, but JavaScript compatibility issues have cropped up. These compatibility problems have no easy solution. You need to weigh the benefit of what the JavaScript is doing against the number of browsers you'll need to test against and support."
Hmmm.... (Score:3, Interesting)
Re:Hmmm.... (Score:5, Funny)
Re:Hmmm.... (Score:3, Insightful)
Who the fuck wrote this?! (Score:5, Insightful)
Aaaaaaaaaaaaaahhh. My eyes are bleeding. What the fuck are you talking about?
In the early days of HTML, Internet Explorer did not exist.
Only IE and Netscape render pages differently?!
Most of the CSS issues have been solved?!? What?!
Javascript compatibility problems are new?@#$?@#$!?
Re:Hmmm.... (Score:1)
Re:Hmmm.... (Score:2)
Re:Hmmm.... (Score:2)
BAM! (Score:4, Funny)
Re:BAM! (Score:1)
customer: overloaded variable. ambiguous. (Score:5, Insightful)
Re:BAM! (Score:1)
Shock (Score:2, Funny)
IE Script Warnings (Score:5, Insightful)
Re:IE Script Warnings (Score:5, Funny)
Re:IE Script Warnings (Score:2)
Re:IE Script Warnings (Score:5, Informative)
That only happens on XP post SP2 and when the content you are viewing is on a local drive. Once your page is uploaded -- or if you give it "The mark of the web" (Google for it) on your local drive -- the yellow warning bar no longer appears.
Re:IE Script Warnings (Score:2)
>That only happens on XP post SP2 and when the content you are viewing is on a local drive.
The fuck? Shouldn't that be reversed? Or at least the same for both? I'm not sure why on earth you should be more trusting of websites than things on your hard drive.
Re:IE Script Warnings (Score:2)
It's more along the lines that you should be more warey of code that is loaded from your local machine and then exectuted -- i's given higher privilages by IE (it's run in the "My Computer" zone rather than "The Internet" zone).
Code that out on the web is harmless (because IE will just refuse to do whatever the script asks) can be very dangerou
Re:IE Script Warnings (Score:1)
Wow (Score:5, Informative)
For me, I really like JavaScript and AJAX when it helps to actually improve the user experience. Dynamic tabs? What's the point? How is it really functionally than just heading to a different page, or using some middleware to control what content is served, after a page reload?
Now, on a website I built [theportlandscene.com], I've used AJAX (shudder) to create a commenting system that doesn't require the user to initially be logged in. The user can visit a page, submit a comment through the form, and if the user isn't logged in, they're presented with the ability to login right then and there, without losing their comment, and without even being shuttled off to a different section of the site, wondering if their comment will post when they're finished. If they don't have an account, they can create one right there. I think those kinds of tricks make remote scripting worthwhile.
Plus, I think adding new widgets to HTML through JavaScript is pretty keen - like the sliders and calendar that Yahoo is making available under the BSD license at their developer area [yahoo.com].
Re:Wow (Score:5, Informative)
Or you could just have the comment submit form include "username" and "password" fields if the user is not logged in, and if you need to go to another page to create an account, move the comment text around in a hidden field. No reason whatsoever to use user-side scripting, just good old PHP / JSP / ASP / whatever.
Re:Wow (Score:2)
Re:Wow (Score:2)
Re:Wow (Score:2)
Since we are talking about human-typed text, and only moving it around when creating an account (once per user, presumably), I have a hard time imagining it to cause significant bandwidth usage. Especially since javascript also consumes space, and it needs to be sent every time someone tries to submit a comment without being logged in, since you can't know beforehand if he already has an
Re:Wow (Score:3, Informative)
I guess "Web 2.0" will never be defined. Is Web 2.0 "thick client" browsing, or is it providing and soliciting community-enhanced content?
Re:Wow (Score:4, Funny)
Defining Web 2.0?
Well, that is a fun game, to be sure, but I prefer Mornington Crescent. The rules are less nebulous.
Re:Wow (Score:3, Insightful)
I don't think it's that. It's just.. rehashed drek from other websites with a
Really, there is NOTHING new in that tutorial that hasn't been done on other beginner websites. Nothing here is really Web 2.0, it's just hiding divs. That was in Javascript a long time ago. There's no backend business, no combining with other technologies. No data being "fetched", no integrati
Re:Wow (Score:2)
Re:Wow (Score:2, Informative)
No, PHP is tired. It's now all about Ruby [ruby-lang.org], Python [python.org], LISP [gigamonkeys.com], and the more obscure but no less interesting Lua [lua.org], Scala [scala.epfl.ch], Qi [lambdassociates.org], OCaml [extremetech.com], among others, and various [rubyonrails.org] derivatives [djangoproject.com] and frameworks [turbogears.org].
Re:Wow (Score:2)
Javascript - Dangerous Nasty Security Risk! (Score:2)
But having Javascript as the scripting language (instead of Java or some other decently secure language) is dangerous and nasty for the user who reads your website, because you're requiring the user to turn Javascript on to see your cool st
The worst page ever. (Score:5, Funny)
Re:The worst page ever. (Score:2, Funny)
# a translucent layer (DIV) is placed over the entire page, causing it to appear "grayed out", and
# a "please wait" layer is placed on top of that, with an animated pendulum swinging back and forth, then
# the XmlHttpRequest object is used to call the "GetHyperlink" web service which, in turn
# opens a connection to the database server to
# log the request in the RequestedHyperlinks table and
#
Re:The worst page ever. (Score:2)
Re:The worst page ever. (Score:2)
Search Engine Visibility (Score:5, Insightful)
Same goes for Flash...
I can't believe how many companies spent tens of thousands of dollars on a CMS package, or to a "web designer" that rendered them invisible to the search engines.
The article does recommend a fallback for unsupported browsers. Take this to heart, because "GoogleBot" is an unsupported browser.
Re:Search Engine Visibility (Score:2)
There's an FPS game map review site [telefragged.com] I used to visit often which has an utterly pointless Javascript 'compression' system behind it, originally coded to supposedly make it load more quickly over dialup connections.
As
Re:Search Engine Visibility (Score:2)
The best part about that WTF is how nobody seems to have noticed it's very similar to how GMail handles links. The only real difference is that the WTF actually uses <a> elements and changes the page location, which means it actually works better than GMail for things like bookmarking, the back button, keyboard navigation, etc.
Re:Search Engine Visibility (Score:2)
The back button intermittently works and doesn't work, depending on which browser you use, your browser settings and exactly what you're clicking on.
As for the keyboard, try tabbing to an email link and reading it. It doesn't work, the emails never get focus. It doesn't work because somebody at Google who was a bit too enamoured with JavaScript thought "Hmm... I need to make something a link. Shall I use
Re:Search Engine Visibility (Score:2)
Re:Search Engine Visibility (Score:2)
Re:Search Engine Visibility (Score:1)
Re:Search Engine Visibility (Score:1)
True, on the other hand, it allows some really cool tricks...
AJAX site: http://www.dutchpipe.org/ [dutchpipe.org]
Yahoo cache: http://216.109.125.130/search/cache?ei=UTF-8&fr=sf p&p=dutchpipe&u=www.dutchpipe.org/&w=dutchpipe&d=N -xgzEaqMtyR&icp=1&.intl=us [216.109.125.130]
Re:Search Engine Visibility (Score:2, Insightful)
The CMS was installed and running for weeks but our client was still requesting modifications after modifications on the lay-out. HTML+CSS and nice visual. Nothing really wrong with it. Until that contract, Our lay-outs would only suffer few modifications before being accepted.
Their profile: a medium interior design company.
We were about to lose money. We spent more money on the lay-out than on the tool in itself. What's puzzled me is tha
Web 2.0 (Score:3, Funny)
Re:Web 2.0 (Score:2)
While we're at it, why don't we find a real name for "AJAX" since when did "and" count as a letter in an acronym?
Re:Web 2.0 (Score:1)
Cheers
[J]
Re:Web 2.0 (Score:2)
How useful is this? (Score:5, Insightful)
Oh greaaaat... (Score:5, Insightful)
Re:Oh greaaaat... (Score:4, Insightful)
Trust me, there is a strong demand for this stuff (it is in use already), and advertisers don't care how much it annoys you. In fact, it's been shown in our in-house studies that really annoying ads work better than ones that are not. This means, the more movement it has, and the more noise it makes, the more effective the ad will probably be. The solution? Convince everyone not to click on them. That would make them go away faster than anything.
The fact of the matter really is that people click on this stuff. More than you probably realize.
Re:Oh greaaaat... (Score:2)
Only in the (very) short term. Sure they get noticed - long enough to make people look for ways to block them - or simply go spend their time (and money) elsewhere.
Re:Oh greaaaat... (Score:2)
Re:Oh greaaaat... (Score:2)
I know man, that's
Re:Oh greaaaat... (Score:1)
PenGun
Do What Now ???
Re:Oh greaaaat... (Score:2)
Have you ever seen those sites where some words have double underlines, when your mouse is over them an annoying box pops up with context sensitive advertising (e.g. for 'hosting' some random hosting company advert would pop up). Guess what? JavaScript and Ajax makes this
Re:Oh greaaaat... (Score:3, Interesting)
Of course, this can all be cured by taking your information from "reputable" websites - but sometimes I like to visit the other side of the tracks, and it just makes me that much more
Unnoticed? (Score:2)
Re:Oh greaaaat... (Score:2)
But you shouldn't be opening windows, it's damned rude.
I've finally settled on doing something like what lightbox does for pictures. It opens the "popup" on the same page, overlayed on top of what is already there. Sort of a modal dialog box. It looks slick, it's not anywhere near as annoying, and it's closable... you can go back to the main page, and nothing is added, n
Urge to kill...rising... (Score:5, Funny)
Next week: Your first phishing page with php and dhtml in just minutes!
Re:Urge to kill...rising... (Score:2)
Re:Urge to kill...rising... (Score:2)
I've seen them put to good use to hide spoilers in forums and the like, like everything, there are good and bad ways to use them, but far fewer good ways than bad.
Re:Urge to kill...rising... (Score:2)
Re:Urge to kill...rising... (Score:1)
Re:Urge to kill...rising... (Score:2)
this is sad... (Score:4, Insightful)
Oh god. (Score:1)
Oh god, won't someone please think of the end users?
Ad boxes, Pop-ups, Spinners, and Tabs (Score:2)
Are the biggest reason to not use Java Script most of the time.
I have a couple PC's. One for trusted sites, and the other for general internet browsing. Some sites display a blank page. Too bad the site doesn't check what the client is running. A blank page does not provide any information including any reason I might want to visit with scripting turned on.
Why is this an article specifically? (Score:3, Informative)
So why choose this seemingly random PAGE that offers (as far as I can tell) nothing new?
What I'm really expecting... (Score:2)
Stupid code (Score:5, Informative)
IBM's JavaScript articles are usually high quality. But this one is awful. It uses invalid code, it doesn't degrade gracefully, it mixes HTML, CSS and JavaScript into the same file instead of separating them, and it breaks when you try and do things as simple as open a link in a new tab.
Don't be fooled by the "senior software engineer with more than 20 years of experience" author, this guy doesn't know the most basic, newbie things. I can only imagine that his 20 years of experience was with something other than HTML, CSS and JavaScript. For example:
That's just the tip of the iceberg. This is an exceptionally poor article.
Re:Stupid code (Score:1, Informative)
SWT calls what he was doing an ExpandBox and I've also seen them called Accordions.
Re:Stupid code (Score:2)
Re:Stupid code (Score:2)
Re:Stupid code (Score:2)
Why bother with PHP? (Score:1)
What the... (Score:3, Insightful)
Seriously, I'm not trying to troll, I'm genuinely at a loss for words here... how... what...???
Gimmicks vs. Usefullness (Score:2, Insightful)
From a practical point of view the information provided by the site in question is useless (not to take away from the efforts of those involved). The focus really should be on the convenient, useful aggregation of content, while providing ease of use for visitors to the site.
I was roped in by the "wowee zowee" stuff as IE battled Netscape in the 90's. Eventually we all realized that coding to the lowest common denominator was the key to creating a consistent, error free experience for our end users.
The
I like this for Slashdot (Score:2)
Please some of the CSS hackers submiting designs for the new
Re:I like this for Slashdot (Score:2)
Re:I like this for Slashdot (Score:2)
And what about other browsers besides Firefox? Or when I'm in places where I can't install software?
That's why I want this to be by default in slashdot.
You have just proved to me that it should be here by default.
Anyway, I'm trying them ASAP, there is anyone that you prefer?
It seems one is deprecated and other is untested.
Re:I like this for Slashdot (Score:2)
Re:I like this for Slashdot (Score:2)
Re:I like this for Slashdot (Score:2)
CSS Issues Have Not Been Solved (Score:4, Insightful)
CSS compatibility issues have been worked around; they have not been "solved", and any quick trip through Position is Everything or A List Apart will show you that. JavaScript compatibility issues have also been around since the first days of JavaScript implementation in browsers.
Neither are going to "be solved", especially if Microsoft have anything to say about it. Right now, as in the past, implementation differences equal a certain degree of lock-in. The truth is that no rendering engine provides a complete, perfect-for-intents-and-purposes CSS2 implementation, and IE is easily at the bottom of that pack. Combined with its field dominance, it is largely responsible for "CSS compatibility issues".
IE 7 isn't going to provide a better rendering engine than Gecko, KHTML/WebCore, or whatever Opera's engine is called; it will simply address a list of the most important problems, such as the infamous box model fuck-ups. There will not be a "kickass" rendering engine in IE 7, and as much as I hate to say it, that's going to keep us in compatibility hack hell for the near future.
Now, if you ask me--and obviously you did, right, lol internet_rant--Microsoft have had more than ample time, people, and resources to produce a rendering engine on-par with Gecko and its peers. But that's not going to be the case. Only one reason for that.
CSS compatibility issues mostly solved? Not even close.
Re:CSS Issues Have Not Been Solved (Score:2)
Actually, I did, once upon a time.
Microsoft have had more than ample time, people, and resources to produce a rendering engine on-par with Gecko and its peers. But that's not going to be the case. Only one reason for that.
Wrong. They haven't had more. They've had INSANELY MORE time, people and resources. What's it been? 5 years now since the last major update? They're sitting on a warchest of $40 billion... and while they can't spend that on the browser alone,
Crap Code Alert (Score:3, Interesting)
This code is crap. Use of <a href="javascript:"> makes it same quality as <marquee><font color="#ggggg">OMG Web 2.0!</td></font>
Unlike TFA, here are some resources worth reading:
Why I left front-end web development (Score:3, Interesting)
I spent years wading through the quagmire of DHTML/CSS/Javascript compatibility issues and eventually realised that it was a full time job getting it right. 'Trouble was the job went largely unrewarded as the end user was only interested in how pretty it looked and it's difficult to get a client to pay you properly for time spent working round compatibility problems. Eventually I got wise and realised M$ had screwed up the CSS and Javascript game beyond recovery and decided to concentrate my energies where my time would be rewarded. I've been working with Perl, PHP, MySQL and PostgreSQL ever since and haven't looked back. For front-end design I keep it simple - basic CSS and no Javascript. That way I can sleep at night and wake refreshed to concentrate on the aspects of web development which add real value to a site. "Web 2.0" won't tempt me back into the fray as IE5/6 issues will haunt web developers for many years yet, regardless of what Vista and IE7 brings.
One area of web development I think is very much neglected is semi-dynamic web development with Template Toolkit and cron. The content of many dynamic sites only changes periodically so it can often be better to have templates generate static pages periodically from your database with a cron script instead of coding the whole site in PHP, Perl/CGI or whatever.
This is new?? (Score:2, Funny)
Re:I already hear... (Score:1)
Haven't you heard? Javascript is the new....uh Javascript.
Re:I already hear... (Score:2)
Nothing, and the article is pathetic. There's nothing "Web 2.0" in there, it's just a series of cheap tricks that any self-respectiv Web developer learned a long time ago. Floating tips, floating layers, showing and hiding elements, puleeeze.
Re:acid test (Score:2)
Re:acid test (Score:1)
Re:Cross-browser Flash. (Score:4, Insightful)
Flash!
Ah-aaaargh!
Seriously though. Flash is an awful choice. One the plus side, you get fairly consistent rendering. On the minus side it completely fucks up your entire interface. Middle-click to open in a new tab? Right-click to bookmark? Shift-click to open in a new window? Ctrl-F? Find-as-you-type?
Flash is great if you want to trade in the quality of the end result for ease of development. But I'd rather put a bit of effort in and get a decent interface rather than put little effort in and get crud. Crud that might look pretty, granted, but still a horrible, horrible interface.
Re:I'm sorry but.. (Score:2)
It it? Where?
Re:Javascript (Score:2, Funny)
Re:I really use JavaScript a lot. (Score:2)
Reality check: most of the world (about 80%, if I remember corectly) is still on dialup.
That page comes in at 43K. The same page in HTML would probably be 2/3 less. When you're trying to sell stuff and keep people on your site, the difference between a 2-3 second download and a 8 second download is huge.
Would it necessarily be as "pretty" as the javascript (or php, ajax, or "bu
Re:I really use JavaScript a lot. (Score:2)
It's true you need to keep an eye on the page size, but a standard slashdot frontpage with graphics is about 35 KB, so 44 KB is very close. And I do belive most of my audience read slashdot.
Very often sending raw html javascript data fills up much less than the formatted page. The unit list is written with a few lines of javascript code, but if it should have been formatted and build on the server it would end up with a size off more than 44 KB.
But you are right in the sense that you
Re:I really use JavaScript a lot. (Score:2)
I think whaty ou've done is entirely appropriate for your application. But let's face it - if you put up a tutorial web page and used that as an example, it would only be a few days before we'd be flooded by 500 meg java pages that did nothing more than c
Re:I really use JavaScript a lot. (Score:2)
<span class="h1">Who am I?</span>
Or the fact that you don't even have a <body>.