Re: [PHP] Why are my style sheets all listed on one line?
At 03:16 AM 1/30/2004, Freedomware wrote: I'm still fairly new to PHP, so there may be a simple fix for my relatively trivial complaint. I'm using an included page as a head section. It works fine, except that when preview a page and view the source, all the style sheets are displayed on one long line, like this: /scriptlink href=../../css/ref.css rel=stylesheet type=text/csslink href=../../css/na/a1.css rel=stylesheet type=text/css /link href=.css rel=stylesheet type=text/css /link href=../../css/nations.css rel=alternate stylesheet type=text/css title=Nations / It looks like they won't scroll across THIS page, so here's a more clear example: stylesheet1stylesheet2stylesheet3stylesheet4 You need a \n at the end of each line inside the quote like echo stylesheet\n; \n is newline -Dave What I want is a normal style sheet display, like this: stylesheet1 stylesheet2 stylesheet3 stylesheet4 Do you know what causes this and if there's a fix? I posted some code from the head section and main page below. Thanks! * * * * * * * * * * HEAD SECTION (included page; ../../includes/ref/head.php) ?php $todayDate = date(m-d-Y); echo 'titleFreedomware gt; ' . $myname . '/title'; echo 'meta name=description content=' . $myname . ' versus Microsoft /'; echo 'meta name=keywords content=' . $myname . ' versus Microsoft /'; echo 'meta name=mssmarttagspreventparsing content=true /'; echo 'meta http-equiv=content-Type content=text/html; charset=iso-8859-1 /'; echo 'meta name=author content=David Blomstrom /'; echo 'script src=' . $periods . 'js/swapclass.js type=text/javascript/script'; echo 'script language=JavaScript src=' . $periods . 'js/sort.js/script'; echo 'script language=JavaScript src=' . $periods . 'js/ss.js/script'; echo 'script language=JavaScript type=text/JavaScript !-- function MM_openBrWindow(theURL,winName,features) { //v2.0 window.open(theURL,winName,features); } //-- /script'; echo 'link href=' . $periods . 'css/ref.css rel=stylesheet type=text/css'; if($includea1 == TRUE){ echo 'link href=' . $periods . 'css/' . $continentcode . '/a1.css rel=stylesheet type=text/css /'; } echo 'link href=' . $mycss . '.css rel=stylesheet type=text/css /'; echo 'link href=' . $periods . 'css/nations.css rel=alternate stylesheet type=text/css title=Nations /'; echo 'link href=' . $periods . 'css/themes/peace.css rel=alternate stylesheet type=text/css title=Peace /'; echo 'link href=' . $periods . 'css/themes/war.css rel=alternate stylesheet type=text/css title=War /'; echo 'link href=' . $periods . 'css/themes/pat' . $countrycode . '.css rel=alternate stylesheet type=text/css title=Patriotism /'; echo 'link href=' . $periods . 'css/themes/nationalism.css rel=alternate stylesheet type=text/css title=Nationalism /'; echo 'link href=' . $periods . 'css/themes/corporate.css rel=alternate stylesheet type=text/css title=Corporate /'; echo 'link href=' . $periods . 'css/themes/conspiracy.css rel=alternate stylesheet type=text/css title=Conspiracy /'; echo 'link href=' . $periods . 'css/themes/media.css rel=alternate stylesheet type=text/css title=Media /'; echo 'link href=' . $periods . 'css/themes/atlantic.css rel=alternate stylesheet type=text/css title=Atlantic /'; echo 'link href=' . $periods . 'css/themes/indian.css rel=alternate stylesheet type=text/css title=Indian /'; echo 'link rel=SHORTCUT ICON href=../../../../us/aaa/favicon.ico /'; ? * * * * * * * * * * MAIN PAGE !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; ?php $myname = 'Alaska'; $mynickname = 'Land of the Midnight Sun'; $mycode = 'ak'; $mywebring = '/world/na/us/ak/'; $myregion = 'north'; $mycountry = 'United States'; $mycontinent = 'North America'; $countrycode = 'us'; $continentcode = 'na'; $periods = '../../'; $tlperiods = '../'; $includea1 = TRUE; include (../../includes/ref/head.php); ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why are my style sheets all listed on one line?
David Obrien wrote: You need a \n at the end of each line inside the quote like echo stylesheet\n; \n is newline -Dave Thanks for the tip. However, I must be doing something wrong. \n didn't work, so I searched Google for PHP + new line and found a page that said you have to use \r\n if you're working on a Windows platform. But that doesn't seem to work, either. (If you do use a special new line for a Windows computer, then publish your website to a Linux server, will that cause problems?) Do I need to modify the new line code because my echo statements are enclosed in single quotes (' '), rather than double quotes ( )? I pasted my entire include page code below. Thanks! ?php $todayDate = date(m-d-Y); echo 'titleFreedomware gt; ' . $myname . '/title'; echo 'meta name=description content=' . $myname . ' versus Microsoft /'; echo 'meta name=keywords content=' . $myname . ' versus Microsoft /'; echo 'meta name=mssmarttagspreventparsing content=true /'; echo 'meta http-equiv=content-Type content=text/html; charset=iso-8859-1 /'; echo 'meta name=author content=David Blomstrom /'; echo 'script src=' . $periods . 'js/swapclass.js type=text/javascript/script'; echo 'script language=JavaScript src=' . $periods . 'js/sort.js/script'; echo 'script language=JavaScript src=' . $periods . 'js/ss.js/script'; echo 'script language=JavaScript type=text/JavaScript !-- function MM_openBrWindow(theURL,winName,features) { //v2.0 window.open(theURL,winName,features); } //-- /script'; echo 'link href=' . $periods . 'css/ref.css rel=stylesheet type=text/css'; if($includea1 == TRUE){ echo 'link href=' . $periods . 'css/' . $continentcode . '/a1.css rel=stylesheet type=text/css /'; } echo 'link href=' . $mycss . '.css rel=stylesheet type=text/css /'; echo 'link href=' . $periods . 'css/nations.css rel=alternate stylesheet type=text/css title=Nations /\r\n'; echo 'link href=' . $periods . 'css/themes/peace.css rel=alternate stylesheet type=text/css title=Peace /\r\n'; echo 'link href=' . $periods . 'css/themes/war.css rel=alternate stylesheet type=text/css title=War /\r\n'; echo 'link href=' . $periods . 'css/themes/pat' . $countrycode . '.css rel=alternate stylesheet type=text/css title=Patriotism /\r\n'; echo 'link href=' . $periods . 'css/themes/nationalism.css rel=alternate stylesheet type=text/css title=Nationalism /\r\n'; echo 'link href=' . $periods . 'css/themes/corporate.css rel=alternate stylesheet type=text/css title=Corporate /\r\n'; echo 'link href=' . $periods . 'css/themes/conspiracy.css rel=alternate stylesheet type=text/css title=Conspiracy /\r\n'; echo 'link href=' . $periods . 'css/themes/media.css rel=alternate stylesheet type=text/css title=Media /\r\n'; echo 'link href=' . $periods . 'css/themes/education.css rel=alternate stylesheet type=text/css title=Education /\r\n'; echo 'link href=' . $periods . 'css/themes/911.css rel=alternate stylesheet type=text/css title=911 /\r\n'; echo 'link href=' . $periods . 'css/themes/bush.css rel=alternate stylesheet type=text/css title=Bush /'; echo 'link href=' . $periods . 'css/themes/campaign.css rel=alternate stylesheet type=text/css title=Campaign /\r\n'; echo 'link href=' . $periods . 'css/themes/na.css rel=alternate stylesheet type=text/css title=NA /\r\n'; echo 'link href=' . $periods . 'css/themes/sa.css rel=alternate stylesheet type=text/css title=SA /\r\n'; echo 'link href=' . $periods . 'css/themes/europe.css rel=alternate stylesheet type=text/css title=Europe /\r\n'; echo 'link href=' . $periods . 'css/themes/asia.css rel=alternate stylesheet type=text/css title=Asia /\r\n'; echo 'link href=' . $periods . 'css/themes/mideast.css rel=alternate stylesheet type=text/css title=Mideast /\r\n'; echo 'link href=' . $periods . 'css/themes/africa.css rel=alternate stylesheet type=text/css title=Africa /\r\n'; echo 'link href=' . $periods . 'css/themes/aus.css rel=alternate stylesheet type=text/css title=Australia /\r\n'; echo 'link href=' . $periods . 'css/themes/pacific.css rel=alternate stylesheet type=text/css title=Pacific /\r\n'; echo 'link href=' . $periods . 'css/themes/atlantic.css rel=alternate stylesheet type=text/css title=Atlantic /\r\n'; echo 'link href=' . $periods . 'css/themes/indian.css rel=alternate stylesheet type=text/css title=Indian /\r\n'; echo 'link rel=SHORTCUT ICON href=../../../../us/aaa/favicon.ico /'; ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why are my style sheets all listed on one line?
Freedomware wrote: David Obrien wrote: You need a \n at the end of each line inside the quote like echo stylesheet\n; \n is newline -Dave ... Do I need to modify the new line code because my echo statements are enclosed in single quotes (' '), rather than double quotes ( )? newline-character should be inside double quotes (\n). For example: instead of: echo 'link href=' . $periods . 'css/nations.css rel=alternate stylesheet type=text/css title=Nations /\r\n'; use: echo 'link href=' . $periods . 'css/nations.css rel=alternate stylesheet type=text/css title=Nations /'.\n; Hope that helps. :) -- Pavel a.k.a. Papi -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why are my style sheets all listed on one line?
Got it. It took me a while to home in on the period. Thanks for the tips! Pavel Jartsev wrote: newline-character should be inside double quotes (\n). For example: instead of: echo 'link href=' . $periods . 'css/nations.css rel=alternate stylesheet type=text/css title=Nations /\r\n'; use: echo 'link href=' . $periods . 'css/nations.css rel=alternate stylesheet type=text/css title=Nations /'.\n; Hope that helps. :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Why are my style sheets all listed on one line?
On 30 January 2004 08:55, Freedomware wrote: David Obrien wrote: You need a \n at the end of each line inside the quote like echo stylesheet\n; \n is newline -Dave Another way you could go, as this is mostly HTML with some PHP values thrown in, is to write it as such -- then all your newlines are present exactly as they appear. This would look something like: ?php $todayDate = date(m-d-Y); ? titleFreedomware gt; ?php echo $myname ?/title meta name=description content=?php echo $myname ? versus Microsoft / meta name=keywords content=?php echo $myname ? versus Microsoft / meta name=mssmarttagspreventparsing content=true / meta http-equiv=content-Type content=text/html; charset=iso-8859-1 / meta name=author content=David Blomstrom / script src=?php echo $periods ?js/swapclass.js type=text/javascript/script script language=JavaScript src=?php echo $periods ?js/sort.js/script' script language=JavaScript src=?php echo $periods ?js/ss.js/script script language=JavaScript type=text/JavaScript !-- function MM_openBrWindow(theURL,winName,features) { //v2.0 window.open(theURL,winName,features); } //-- /script link href=?php echo $periods ?css/ref.css rel=stylesheet type=text/css ?php if($includea1){ ? link href=?php echo $periods ?css/?php echo $continentcode ?/a1.css rel=stylesheet type=text/css / ?php } ? link href=?php echo $mycss ?.css rel=stylesheet type=text/css / echo 'link href=' . $periods . etc. etc. By the way, the test if($includea1 == TRUE) should be written as just if($includea1) It has exactly the same outcome, but is both more readable (if you've named your variables suitably) and more efficient (since you've saved the redundant comparison operation). Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why are my style sheets all listed on one line?
Wow, thanks for the tips. That makes life a lot simpler! Mike Ford wrote: Another way you could go, as this is mostly HTML with some PHP values thrown in, is to write it as such -- then all your newlines are present exactly as they appear. This would look something like: By the way, the test if($includea1 == TRUE) should be written as just if($includea1) It has exactly the same outcome, but is both more readable (if you've named your variables suitably) and more efficient (since you've saved the redundant comparison operation). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why are my style sheets all listed on one line?
Freedomware wrote: I'm still fairly new to PHP, so there may be a simple fix for my relatively trivial complaint. I'm using an included page as a head section. It works fine, except that when preview a page and view the source, all the style sheets are displayed on one long line, like this: It sounds like you have figured out the problem, however I thought I would share another method that I like to use in similar situations. ?php $todayDate = date(m-d-Y); printEND titleFreedomware gt; $myname /title meta name=description content= $myname versus Microsoft / meta name=keywords content= $myname versus Microsoft / meta name=mssmarttagspreventparsing content=true / meta http-equiv=content-Type content=text/html; charset=iso-8859-1 / meta name=author content=David Blomstrom / script src= $periods js/swapclass.js type=text/javascript/script script language=JavaScript src= $periods js/sort.js/script script language=JavaScript src= $periods js/ss.js/script script language=JavaScript type=text/JavaScript END; ? there is one pit fall on this method that I run into sometimes. If your code is indented like it should be that moves the END; away from the beginning of the line and it won't work. So this wouldn't work, while(for a while){ if(this){ do stuff; printEND bunch of stuff here END; do more stuff; } end of while } The END; must be the first text on the line, so it has to be like this, while(for a while){ if(this){ do stuff; printEND bunch of stuff here END; do more stuff; } end of while } Chris W -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php