|
-
March 13th, 2010, 11:35 AM
#1
How to make Tab in PHP?
I am not sure how to make a tab in PHP. I assumed it was the "\t" code but it is not working for me. I want to all the print lines after the shipping to, to be tabbed to the right. How can I do this? This is my code:
Code:
print ("Shipping To: $lastName, $firstName <br>");
print ("$address <br>");
print ("$city, $province <br>");
print ("$postalCode <br>");
I tried to add the "\t" in the print statements but its not working.
-
March 15th, 2010, 10:03 AM
#2
Re: How to make Tab in PHP?
you might have to resort to CSS and include some markup (html) in your print commands, like padding or margins. correct me if I'm wrong, but I don't think there's a straight command like \n or \t for tabs
Last edited by bobo; March 15th, 2010 at 12:45 PM.
-
March 16th, 2010, 12:21 PM
#3
Re: How to make Tab in PHP?
Yes, \t is a tab, but you must remember that HTML output will treat a tab as a space. You will need to string a couple of together in order to get multiple spaces to show.
Honestly, if you want that to line up, just to two divs side by side in the output.
If the post was helpful...Rate it! Remember to use [code] or [php] tags.
-
March 16th, 2010, 12:30 PM
#4
Re: How to make Tab in PHP?
that makes sense since in html land the only space that matters is the first one... then they are irrelevent, or ignored by html. So with that said... as far as html is concerned /t will not give you a tab... might work in C or other object oriented language.
Maybe if you use a <pre> tag?
-
March 16th, 2010, 01:49 PM
#5
Re: How to make Tab in PHP?
As i remember from php tutorials complete PHP code to create tabs is:
PHP Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Using Tabs With PHP</title>
<style>
.link{
font-family:tahoma;
font-size:11px;
font-weight:bold;
color:white;
text-decoration:none;
}
</style>
</head>
<body>
<?
$id=$_REQUEST['id'];
$links=array();
$links[]="Home";
$links[]="Services";
$links[]="Products";
$links[]="Downloads";
$links[]="Contact Us";
$total_links=count($links);
?>
<table cellpadding="0px" cellspacing="0">
<tr>
<td width="30px"> </td>
<?
for($i=0;$i<$total_links;$i++){
if($i+1==$id){
?>
<td style="padding-left:3px">
<table cellpadding="0" cellspacing="0">
<tr height="28px">
<td width="15px"><img src="images/selected-left.gif" /></td>
<td style="background-image:url(images/selected.gif);" class="link"><?=$links[$i]?></td>
<td width="15px"><img src="images/selected-right.gif" /></td>
</tr>
</table>
</td>
<? } else { ?>
<td style="padding-left:3px">
<table cellpadding="0" cellspacing="0">
<tr height="28px">
<td width="13px"><img src="images/tab-left.gif" /></td>
<td style="background-image:url(images/tab.gif);"><a href="?id=<?=$i+1?>" class="link"><?=$links[$i]?></a></td>
<td width="13px"><img src="images/tab-right.gif" /></td>
</tr>
</table>
</td>
<? } // else end
} //for end
?>
<td width="30px"> </td>
</tr>
<tr>
<td colspan="<?=$total_links+2?>" bgcolor="#1895D5"> </td>
</tr>
<tr>
<td colspan="<?=$total_links+2?>" style="border:1px #1895D5 solid;">
<h1 style="color:#1895D5">The text for linkid<?=$id?> goes here ...</h1>
</td>
</tr>
</table>
</body>
</html>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|