Jump to content

[SOLVED] Help on code output


Miss-Ruth

Recommended Posts

My CODE:

 

	echo "<phone>".$line["phone"]."</phone>";
echo "<fax>".$line["fax"]."</fax>";
echo "<genemail>".$line["genemail"]."</genemail>";
echo "</item>";

 

 

I need the output to look like this. (all in one line including the spaces)

 

Phone: 15614524      Fax: 13456789      Email: [email protected]

 

How should the ode be amended?

Link to comment
https://forums.phpfreaks.com/topic/179163-solved-help-on-code-output/
Share on other sites

Hi Miss-Ruth,

 

You could do it a number of ways, the quickest (but ugliest) method is to use lots of  .

 

For example:

 

echo "<phone>".$line["phone"]."</phone>     ";
echo "<fax>".$line["fax"]."</fax>     ";
echo "<genemail>".$line["genemail"]."</genemail>";
echo "</item>";

 

However, it would be much better to stick the items into DIVS and use CSS to add padding.

 

For example:

 

echo "<div class="phone"><phone>".$line["phone"]."</phone></div>";
echo "<div class="fax"><fax>".$line["fax"]."</fax></div>";
echo "<div class="genemail"><genemail>".$line["genemail"]."</genemail></div>";
echo "</item>";

 

Then, in your CSS file add:

 

.phone{
padding-right: 10px;
display: inline;
}

.fax{
padding-right: 10px;
display: inline;
}

.genemail{
display:inline;
}

 

Hope this helps.

Thanks Bricktop!!!  :D

 

Sorry! I didn't know that's important.

 

I came here expecting a quick answer rather than reading since I've got load of work to finish today. It would be great if someone could offer me with a final code! If no responses I'll use your link to see how to write it.

Hi Miss-Ruth,

 

OK, first of all you need to link to a CSS file in your XML opener like so:

 

<?xml-stylesheet href="style.css" type="text/css"?>

 

Now, create a file called style.css and add the following:

 

PHONE { padding-right: 10px; display:inline }
FAX { padding-right: 10px; display:inline }
GENEMAIL { display:inline }

 

Remember to upload style.css to your server.

 

Hope this helps.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.