Re: Getting PHP variables to display fixed length
- From: boclair <boclair@xxxxxxxxxxxxxx>
- Date: Sat, 29 Oct 2005 13:41:38 GMT
Japhy wrote:
Can I suggest that the date needs to be moved to a known position to the right of the name and that sufficient space be provided for the longest name. An html table is one way. The other is CSS, eg,Hello, I am coding a menu using PHP. Selections on the menu have code like :
<li> <a href="Updatefindatesedit.php">$fin_name1 $fin_date1 </a></li> <li> <a href="Updatefindatesedit.php">$fin_name2 $fin_date2 </a></li> etc
My problem is the $fin_name1 variables can be anywhere from 1 - 20 characters
so my menu items come out looking like Joe 2000/01/01 Fred 2001/01/02 Alexander 2001/01/03
Can I get the $fin_name* variable to take up a fixed amount of space when displaying? My idea is to use strlen on fin_name and put a number of  's between, but that sure seems like a dumb way to do it. I figure someone with more knowledge can tell me an easier way to do it.... TIA Japhy
<ul>
<li style="width:12em;"> <div style="float:right;width:4px;text-align:right;">yyyy/mm/dd</div> fin_name </li>
<li style="width:12em;"> <div style="float:right;width:4px;text-align:right;">yyyy/mm/dd</div> fin_longer-name</li>
</ul>
adjust the width of the containing div and the float div to suit.
Ideally the css declarations will be in selectors in a style block or style ***, e.g.
<style type="text/css">
ul.name-date li { width:12em; }
ul.name-date li div { float:right;width:4px;text-align:right; }
</style></head>
<body>
<ul class="name-date">
<li> <div>yyyy/mm/dd</div> fin_name </li>
<li> <div>yyyy/mm/dd</div> fin_longer-name</li>
</ul>
Louise .
- Follow-Ups:
- References:
- Getting PHP variables to display fixed length
- From: Japhy
- Getting PHP variables to display fixed length
- Prev by Date: Re: PHP / Javascript menu list population
- Next by Date: Re: PHP / Javascript menu list population
- Previous by thread: Re: Getting PHP variables to display fixed length
- Next by thread: Re: Getting PHP variables to display fixed length
- Index(es):