RE: [PHP-GENERAL] pretty in Browser UGLY in source.

From: Date: Fri, 09 Jun 2000 13:42:31 +0000
Subject: RE: [PHP-GENERAL] pretty in Browser UGLY in source.
Groups: php.general 
Request: Send a blank email to php-general+get-1389@lists.php.net to get a copy of this message
Remove the end of line from each line you read in from the file. This is causing a lot of your problems. something along the lines of: $tempanc = substr($line,0,strlen($line)-1); I thought I was the only one who worried about these things? alex.. > -----Original Message----- > From: Lewis Bergman [mailto:lbergman@abi.tconline.net] > Sent: 09 June 2000 13:45 > To: php-general@lists.php.net > Subject: [PHP-GENERAL] pretty in Browser UGLY in source. > > > My problem is that I cannot seem to solve the problem of the > UGLY html source > output by this code. The code looks great in the browser but > if you view the > source you get this: > <A HREF="help.php#addresses > " target="right"><BR><FONT SIZE=+1>Addresses > </FONT></A><BR> > <A HREF="help.php#nick > " target="right">Nick Name > </A><BR> > <A HREF="help.php#email_add > " target="right">Email > </A><BR> > > I would like it to output this instead: > <A HREF="help.php#addresses" target="right"><BR><FONT > SIZE=+1>Addresses</FONT></A><BR> > <A HREF="help.php#nick" target="right">Nick Name</A><BR> > <A HREF="help.php#email_add" target="right">Email</A><BR> > > As if someone with some sense wrote the page. But it seems > rthat no matter what > I try it doesn't work. > I tried collecting the vars at the end of the loop and then > printing them out > but that didn't work eithert. Any ideas would be appreciated. > > <?php > /** > ** left_help.php > ** > ** This is the code for the left bar (frame). The left bar > normally shows the > folders ** available, and has cookie information. This file > is only used for > the help system. ** To be used, webmail must be called with > ?help.php. > ** > **/ > > /** > ** Array used to list the include .hlp files, we could use a > dir function > ** to step through the directory and list its contents but it > doesn't order those. > ** This should probably go in config.php but it might mess up conf.pl > **/ > $helpdir[0] = "basic.hlp"; > $helpdir[1] = "main_folder.hlp"; > $helpdir[2] = "read_mail.hlp"; > $helpdir[3] = "addresses.hlp"; > $helpdir[4] = "compose.hlp"; > $helpdir[5] = "folders.hlp"; > $helpdir[6] = "options.hlp"; > $helpdir[7] = "FAQ.hlp"; > > /** > ** Build a menu dynamically for the left frame from the HTML > tagged right frame include (.hlp) files listed in the $helpdir var. > ** This is done by first listing all the .hlp files in the > $helpdir array. > ** Next, we loop through the array, for every value of > $helpdir we loop through the file and look for anchor tags > (<A NAME=) and > ** header tags (<H1> or <H3>). > **/ > > if (!file_exists("../help/$user_language")) > // If the selected language doesn't exist, use english > $user_language = "en"; > > > while ( list( $key, $val ) = each( $helpdir ) ) { > // loop through the array of files > $fcontents = file("../help/$user_language/$val"); > // assign each line of the above file to another array > while ( list( $line_num, $line ) = each( $fcontents ) ) { > // loop through the second array > $temphed=""; > $tempanc=""; > > if ( eregi("<A NAME=", $line, $tempanc)) { > // if a name anchor is found, make a link > $tempanc = $line; > $tempanc = str_replace("<A NAME=", "", $tempanc); > $tempanc = str_replace("></A>", "", $tempanc); ..... -- This communication contains information which is confidential and may also be privileged. It is for the exclusive use of the intended recipient(s). If you are not the intended recipient(s), please note that any distribution, copying or use of this communication or the information in it is strictly prohibited. If you have received this communication in error, please notify the sender immediately and then destroy any copies of it.

« previous php.general (#1389) next »