
|
View Full Version : How can I insert spaces on the screen?
Hi
I want to add 5 spaces inbetween the variable hours_to_complete and the text 'Printable'. If I put many spaces inside an echo then it gets displayed as a single space.
I also tried using multipule characters, but that got interpretted as a space when I saved the code and so resulted in only 1 space.
<?
echo("Hours to complete course: ");
echo($hours_to_complete);
echo(" ");
echo("Printable: ");
echo($printable);
?>
Thanks in advance for your help,
Andy
Noldar 09-10-2002, 08:18 AM Use
for spaces, so your code would be
echo("Hours to complete course: ");
echo($hours_to_complete);
Richard
Rich2k 09-10-2002, 08:26 AM Yes this isn't a PHP problem, simply the way HTML renders.
You might like to consider using a table rather than lots of blank spaces.
Hi Richard,
Thanks for your quick response.
That did the trick.
Cheers
Andy
Acronym BOY 09-10-2002, 09:43 AM Originally posted by Rich2k
You might like to consider using a table rather than lots of blank spaces.
Tables are not to be used for layout. It violates the W3C spec:
Tables should not be used purely as a means to layout document content as this may present problems when rendering to non-visual media. Additionally, when used with graphics, these tables may force users to scroll horizontally to view a table designed on a system with a larger display. To minimize these problems, authors should use style sheets to control layout rather than tables.
See also:
http://wdvl.internet.com/Authoring/Style/Sheets/Positioning/Toss/
http://www.alistapart.com/stories/practicalcss/
Google for more
Rich2k 09-10-2002, 09:44 AM What a load of BS.... try to find me a website (other than w3.org) that doesn't use tables for layout!
If you use % in tables it's highly unlikely you would ever need to scroll horizonally
of course this bit of code from the front page of w3.org is quite funny
<table
summary="Layout table: The first cell contains a navigation bar of W3C technologies, the second contains news, and the third another navigation bar of W3C pages."
border="0" width="99%" cellspacing="0" cellpadding="10">
Rich2k 09-10-2002, 09:49 AM Actually I'll correct myself. http://www.parliament.uk 's new site seems to make very good use of CSS
Of course those poor souls still using Netscape 4.x or Lynx are up the creek with pure CSS sites.
And then those browsers that decide to use XHTML 2.0 in the future will break all previous web sites (http://news.com.com/2100-1023-949492.html)
I simply do not understand the mentalilty of some of the stuff the W3C comes out with sometimes.
Acronym BOY 09-10-2002, 03:20 PM Originally posted by Rich2k
What a load of BS.... try to find me a website (other than w3.org) that doesn't use tables for layout!
http://www.sgtaylor.com/
http://www.alistapart.com/
http://www.alistapart.com/stories/betterliving/
http://www.thenoodleincident.com/tutorials/box_lesson/boxes.html
http://glish.com/css/
http://www.bluerobot.com/
http://www.bluerobot.com/web/layouts/
http://www.meyerweb.com/eric/css/
http://www.meyerweb.com/eric/css/edge/
Hell, even the New York Public Library:
http://www.nypl.org/styleguide/
A free blogging tool:
http://www.pmachine.com/features.php
Originally posted by Rich2k
Of course those poor souls still using Netscape 4.x or Lynx are up the creek with pure CSS sites.
In short, sweet words: CSS1 support is at least partially available for more than 96% of the current browser population, with a good CSS2 support for about 80% of today's browsers.
Less people have Flash than are CSS compatible. Yet people here seem to love websites with fancy Flash deisgns that can not be navaigated by many.
And about that text browsing (lynx) and about people who use cell phones to access the net and those with disabilites?
HTML does not take them into account. XHTML is a better replacement for them as it increases accessibility:
The future of the web is accessibility.
Your content must be accessible to disabled readers. More importantly, your content must be accessible to other computers. Computers will be pumping your site into more intelligent search engines, which will need to glean meaning from your document structure, not just the raw text. Computers will be automatically downscaling your page for smaller screens . Computers will be picking out the content in a page and automatically hiding the index and table of contents.
Computers can understand XML. Computers can't understand complex HTML that uses what are supposed to be structural elements (like TABLE) to layout your content.
Furthermore, as we have more and more versions of browsers out there in the wild, it becomes harder and harder to support them and test in all of them. The only viable solution is "graceful degredation". Code for the standards. Hope the browsers implement the standards.
Also:
The whole point of XHTML is to make the semantic structure of a web page more obvious. You're not laying out a magazine page here; you're structuring information, and adding some optional tips (I can override any formatting in your page at the touch of a button) on how it might be formatted. The information and its semantic structure is the important thing, not the presentation. If the presentation is the important thing, send me a paper magazine
And:
W3C is looking to the future. It sees the very real possibility of the Web becoming more than a bunch of largely static pages that you surf with browsers whilst sitting in front of a PC. On one front, the separation of content and presentation is allowing users to stream news straight to their desktop, to build new interfaces without changing any underlying data (have you seen the Google-like Amazon.com interface?). On another front, the Web is moving to cellphones, set-top boxes, refrigerators, you name it. And if there isn't some standard language in which all these devices can communicate, some easy way for MyDesktop to get what it needs from UberNews.alt without hiccups, then this future is not going to happen.
Heres a nice little pearl of wisdom:
The zen of web design is understanding that HTML means that all clients will (should) be able to view your page, not that they will all be able to view your page as you view it or as you intended for them to view it.
And lets take some advice intended for pros who do this for a living how it can save companies money:
http://hotwired.lycos.com/webmonkey/02/33/index1a.html
And going back to the browsers issue:
http://www.alistapart.com/stories/tohell/
As well as:
http://www.gerbilbox.com/newzilla/general/general03.php
Which lets you know Mozilla is a browser design to adhere to the webstandards.
And about lynx, it works fine with a CSS heavy site. I use lynx all the time. But people who have poor code that doesnt even validtate as html 4.01 focres me to use a gui browser. Its the wanna be webmasters who dont know what a div tag is that kill accessibility.
Originally posted by Rich2k
And then those browsers that decide to use XHTML 2.0 in the future will break all previous web sites
XHTML 2 isnt the current recomndation though, and wont be for a while. They will be taking suggestions through Januray and will probably make it a recomendation sometime midsummer. Until than XHTML 1 is the spec recomended by wc3 as well as webstandards.org:
http://www.webstandards.org/about/
And XHTML 1 is backwards compatible due to the fact its a subset of HTML 4.
Any website I design is XHTML 1 Strict complaint and looks fine in lynx, mozilla, IE 5+, and NS 4+. It takes a lot more to get it to look right in ****ty browsers due to the fact that they are not compliant. If all browsers were complaint, my work would be cut in half.
Use of tables is fine to display data, but should not be used purely as a means for layout. The web is not about typography. Have you tried browsing the web on a Palm Pilot? A lot easier with sites that are complaint than sites that have huge tables full of images that take up twice the size of the screen.
Rich2k 09-10-2002, 03:50 PM Fair enough, however in the case of the original request it looks like it's possibly the sort of thing which may contain a number of additional sets of data. If so then tables are certainly the best thing to display the data. If it were simply to be by itself then sure there are other ways around it.
Interestingly mozilla.org isn't written to XHTML 1.0 compliance... infact it doesn't even validate to HTML 4.01 or HTML 3.2... but that's just being picky :)
Yes there are standards but the great thing about the technology is people find a way to improve and extend it. There are some great features available in IE... of course you should make sure it's compliant with other browsers as well. Designing for simply one browser is a bad thing to do.
Acronym BOY 09-10-2002, 06:09 PM Originally posted by Rich2k
Fair enough, however in the case of the original request it looks like it's possibly the sort of thing which may contain a number of additional sets of data. If so then tables are certainly the best thing to display the data. If it were simply to be by itself then sure there are other ways around it.
For data, thats ideal for tables. But images that are cut up and than pieceds together with tables as well as sites like this:
http://netstarhost.com/
http://www.axxishost.com/
http://www.silicon-edge.com/
(I just pulled those at random from shared hosting offers)
...are not in compliance and will give disabled people trying to browse the net as well as many other interfaces, a very hard time.
Tables are great and do have a purpose. See here:
http://www.w3.org/WAI/GL/wcgl-last-call
(oddly enough, if you follow the link at the top to teh linear version, it leads you here http://www.w3.org/WAI/GL/wcgl-last-call-linear.html and the link now lets you switch to tabular. The reason is tables give a lot of currently uncommon tools of accessing the net a hard time)
The thing that had me thiking tables were being used for layout was "lots of blank spaces". Usually people use lots of blank spaces to spread thngs out and play typographer. Thats not how the web is supposed to work. Maybe a few years ago when every web page was supposed to look the same no matter who was looking at it, but no more. The future of the web is accessibility and keeping that in mind, people will be visintg your website from their cell phone, palm pilot, watch, toaster, TV, and many more. Warner ten Kate emphasized this (a link is found on the last link I just gave you) here:
http://lists.w3.org/Archives/Public/w3c-wai-gl/1999JanMar/0339.html
And about Mozilla.org being filled with tables and far from validating in any sort of way, yes, Im aware, I sent them a nasty email a long time ago.
In a perfect world every browser would be 100% complaint. Than I would write for spec and evryone would be happy, even people who surf the web on their toaster. :)
Rich2k 09-10-2002, 06:13 PM or get their fridge to order the shopping ;)
benoire 09-10-2002, 06:51 PM I agree with all the comments about standards compliancy, using CSS instead of tables etc, however, when you quote
You're not laying out a magazine page here; you're structuring information, and adding some optional tips (I can override any formatting in your page at the touch of a button) on how it might be formatted. The information and its semantic structure is the important thing, not the presentation. If the presentation is the important thing, send me a paper magazine
this isn't strictly true... at least, whilst it may be the vision of how the web should be, in reality its not always like this... some people like to see nice sites, they like to see typography etc etc. The web isn't simply a way to provide information, it is there for presentation too - how many newspapers or magazines do you think would sell if they were just pages of text with no layout etc to them?
That's not to say the way data is stored is not important - it is important that it can be accessed via different media, however it should also be well presented within that media through the use of CSS etc. If someone chooses to surf the web with Lynx or on their toaster without any interest in presentation/images etc, that's their choice, however this is not the way most people surf the web. I for one enjoy visiting well presented sites, and like the variation you see across the web. Whilst surfing with text-only browsers has its uses at times, for me, and I guess most people, seeing 'nice' looking sites is an integral part of the 'surfing experience' (Unfortunately I can't think of better words than those to describe this at the mo as I'm shattered :D)
Acronym BOY 09-10-2002, 08:27 PM But you can make websites that look nice and validate. You just need to know what you are doing. These are perfect examples:
http://www.alistapart.com/
http://www.bluerobot.com/
Right now many people use desktop PCs, but they are being replaced, and XHTML 1 is supposed to be a stepping stone to the new web, where cell phones, toasters, fridges, palm pilots, watches and TVs all surf the web. That is why XHTML 1.0 is 100% backwards complaint (CSS is another story for NS 4 users, they will just see unformatted test in a linear fashion).
But in the end, the web should not look the same everywhere you view it. It needs to migrate fully to XML, which computers, search engines, pal pilots, etc can and do understand. They can not understand HTML. HTML is just that, a "mark up language", which is fine if everyone is using PCs, but is horrible when people use palm piloots, watches, etc. You need XML, which is something computers can break down and restructure accordinly adn that is the purpose of XHTML 1.0 to form a bridge between mark up language to the new web of seperating content versus layout.
Does it make it harder at first? Yes. XHTML is very strict compared to HTML. Is it the future of the web? Yup. Im just gettting ready early. HTML 4.01 is still a valid spec, but even in that, they dont want you using tables for layout. XHTML is just the bridge to the future. The longer you wait, the more work you will have to do.
Alturus 09-11-2002, 12:36 AM AcronymBOY: Represent, always enjoy your posts at Ars :)
I'm a strong advocate of CSS/XHTML and the fact that tables are clumsy; for stated reasons. My site (http://www.alturus.ca) which validates 100% will never touch a table.
http://www.webhostingtalk.com/showthread.php?s=&threadid=73554
Acronym BOY 09-11-2002, 12:57 AM Fancy meeting an Arsian over here. Seems we tend to over run the internet to the envy of slashdotters everywhere.
Its always nice to meet a compliant coder as well :D
Could you tell I blatantly stole content from a few Arsians?
http://arstechnica.infopop.net/OpenTopic/page?a=tpc&s=50009562&f=6330927813&m=1190911035
Youve got mail.
edit: this thread has gone way way way off topic :stickout
Alturus 09-11-2002, 01:14 AM Yeah I did too : ) I couldn't word my thoughts properly so I saved a little headache and time by Searching the symposium for some relevant material.
Acronym BOY 09-11-2002, 01:46 AM Originally posted by Alturus
Yeah I did too : ) I couldn't word my thoughts properly so I saved a little headache and time by Searching the symposium for some relevant material.
That thread, along with a few others, has been saved locally (due to infoburps) and added to my favorites as well in case I ever need to look back to it.
Take care!
--Brian
benoire 09-11-2002, 07:14 AM Originally posted by Acronym BOY
But you can make websites that look nice and validate. You just need to know what you are doing. These are perfect examples:
http://www.alistapart.com/
http://www.bluerobot.com/
Right now many people use desktop PCs, but they are being replaced, and XHTML 1 is supposed to be a stepping stone to the new web, where cell phones, toasters, fridges, palm pilots, watches and TVs all surf the web. That is why XHTML 1.0 is 100% backwards complaint (CSS is another story for NS 4 users, they will just see unformatted test in a linear fashion).
But in the end, the web should not look the same everywhere you view it. It needs to migrate fully to XML, which computers, search engines, pal pilots, etc can and do understand. They can not understand HTML. HTML is just that, a "mark up language", which is fine if everyone is using PCs, but is horrible when people use palm piloots, watches, etc. You need XML, which is something computers can break down and restructure accordinly adn that is the purpose of XHTML 1.0 to form a bridge between mark up language to the new web of seperating content versus layout.
Does it make it harder at first? Yes. XHTML is very strict compared to HTML. Is it the future of the web? Yup. Im just gettting ready early. HTML 4.01 is still a valid spec, but even in that, they dont want you using tables for layout. XHTML is just the bridge to the future. The longer you wait, the more work you will have to do.
I think you misunderstood me (unless I misunderstood you :D)... I never said compliancy isn't the way forward - I myself code to standards with xHTML and don't use tables for layout etc. Like I said in my previous post, the way data is stored is important, I was just highlighting a point you made where you said the web is not about presentation. Yes, you can make a site look nice, but I was arguing the principal of whether the web was intended for presentation or not, not whether it was possible to do it or not :)
XML is indeed the way forward so that your security light can tell your interior lights to turn on, the kettle to switch on, and put the TV onto your favourite channel. But that doesn't mean that accessing information via conventional methods doesn't have to be compromised.
Of course, there are other advantages of using CSS etc other than simply standards compliancy - you get a much better control of the look and feel of a site, and can make huge changes to the layout etc very easily, and even dynamically if required.
Acronym BOY 09-11-2002, 09:49 AM Originally posted by benoire
I think you misunderstood me (unless I misunderstood you :D)... I never said compliancy isn't the way forward - I myself code to standards with xHTML and don't use tables for layout etc. Like I said in my previous post, the way data is stored is important, I was just highlighting a point you made where you said the web is not about presentation. Yes, you can make a site look nice, but I was arguing the principal of whether the web was intended for presentation or not, not whether it was possible to do it or not :)
XML is indeed the way forward so that your security light can tell your interior lights to turn on, the kettle to switch on, and put the TV onto your favourite channel. But that doesn't mean that accessing information via conventional methods doesn't have to be compromised.
Of course, there are other advantages of using CSS etc other than simply standards compliancy - you get a much better control of the look and feel of a site, and can make huge changes to the layout etc very easily, and even dynamically if required.
Oh yeah, welll, urmmmm, uhhh, I agree! :)
|