2010-11-07 90 views
0

我有一個PHP文本鏈接生成麪包屑,我無法弄清楚如何消除生成的鏈接之前和之後的額外空間。這是最後一個環節:文本鏈接之前和之後的額外空間!需要刪除!

網站鏈接:link text

<div id="crumbs"> 
<a class="crumbs" href="http://www.myorphan.com/index.htm">HOME</a>//<a class="crumbs" 
href="http://www.myorphan.com/blog/">BLOG</a>//<a class="crumbs caps"><?php if (is_day()) : ?> 
<?php printf(__('Daily Archives: <span>%s</span>', 'twentyten'), get_the_date()); ?> 
<?php elseif (is_month()) : ?> 
<?php printf(__('Monthly Archives: <span>%s</span>', 'twentyten'), get_the_date('F Y')); ?> 
<?php elseif (is_year()) : ?> 
<?php printf(__('Yearly Archives: <span>%s</span>', 'twentyten'), get_the_date('Y')); ?> 
<?php else : ?> 
<?php _e('Blog Archives', 'twentyten'); ?> 
<?php endif; ?> 
</a>//</div> 
+0

是U指...之前和之後的空白處? – stillstanding 2010-11-07 07:38:28

回答

2
+0

你會把它放在腳本中? – Erik 2010-11-07 01:38:56

+0

@Erik在哪裏打印需要修剪的字符串。在你的情況下像'printf(trim($ stuff))' – 2010-11-07 01:40:18

+0

我得到錯誤:<?php printf(trim($ stuff))('Monthly Archives:%s','twentyten'),get_the_date ('F Y')); ?> – Erik 2010-11-07 01:42:57

0

這是做它的盲目方式,但試試這個:

<div id="crumbs"> 
<a class="crumbs" href="http://www.myorphan.com/index.htm">HOME</a>//<a class="crumbs" 
href="http://www.myorphan.com/blog/">BLOG</a>//<a class="crumbs caps"><?php if (is_day()) : ?> 
<?php printf(__('Daily Archives: <span>%s</span>', 'twentyten'), trim(get_the_date())); ?> 
<?php elseif (is_month()) : ?> 
<?php printf(__('Monthly Archives: <span>%s</span>', 'twentyten'), trim(get_the_date('F Y'))); ?> 
<?php elseif (is_year()) : ?> 
<?php printf(__('Yearly Archives: <span>%s</span>', 'twentyten'), trim(get_the_date('Y'))); ?> 
<?php else : ?> 
<?php _e('Blog Archives', 'twentyten'); ?> 
<?php endif; ?> 
</a>//</div> 
+0

謝謝你......但它沒有工作... – Erik 2010-11-07 03:33:28

相關問題