473,405 Members | 2,415 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

2nd line indent on wrapped text?

hey everyone

wasn't sure if this was an html or php issue. i'm working on a wordpress site (http://subt.net/wordpress) and having trouble figuring out how to indent the 2nd line of wrapped text w/in a .php widget. see full widget php code below.

on the subt.net/wordpress site, if you look under the 'up and coming shows' left sidebar widget, there's a show titled 'eli paperboy reed & the true loves'.. many of the show entries are only 1-lined, but in some cases it spills on the 2nd line. in those cases, i'd like the 2nd to indent so it lines up with the artist name instead of the show date.

i've tried adding nbsp's to the show's title. it's a quick fix and displays perfectly inside the widget, but the nbsp's are shown on other pages where the show title appears.

is there anyway format this w/in php? i'm a php newbie btw, any help is greatly appreciated!

Expand|Select|Wrap|Line Numbers
  1. <?php
  2.  
  3. //Sidebar Widget file
  4.  
  5.  
  6. class ListCategoryPostsWidget extends WP_Widget{
  7.  
  8.     function ListCategoryPostsWidget() {
  9.         parent::WP_Widget(false, $name = 'ListCategoryPostsWidget');
  10.     }
  11.  
  12.     function widget($args, $instance) {
  13.         extract( $args );
  14.         $title = apply_filters('widget_title', $instance['title']);
  15.         $limit = (is_numeric($instance['limit'])) ? $instance['limit'] : 5;
  16.         $orderby = ($instance['orderby']) ? $instance['orderby'] : 'date';
  17.         $order = ($instance['order']) ? $instance['order'] : 'desc';
  18.         $exclude = ($instance['exclude'] != '') ? $instance['exclude'] : 0;
  19.         $excludeposts = ($instance['excludeposts'] != '') ? $instance['excludeposts'] : 0;
  20.         $offset = (is_numeric($instance['offset'])) ? $instance['offset'] : 0;
  21.         $category_id = $instance['categoryid'];
  22.         $dateformat = ($instance['dateformat']) ? $instance['dateformat'] : get_option('date_format');
  23.                 $showdate = ($instance['show_date'] == 'on') ? 'yes' : 'no';
  24.                 $showexcerpt = ($instance['show_excerpt'] == 'on') ? 'yes' : 'no';
  25.                 $showauthor = ($instance['show_author'] == 'on') ? 'yes' : 'no';
  26.                 $showcatlink = ($instance['show_catlink'] == 'on') ? 'yes' : 'no';
  27.  
  28.                 echo $before_widget;
  29.                 echo $before_title . $title . $after_title;
  30.                 $atts = array(
  31.                         'id' => $category_id,
  32.             'orderby' => $orderby,
  33.             'order' => $order,
  34.             'numberposts' => $limit,
  35.             'date' => $showdate,
  36.             'author' => $showauthor,
  37.             'dateformat' => $dateformat,
  38.             'template' => 'default',
  39.             'excerpt' => $showexcerpt,
  40.             'exclude' => $exclude,
  41.             'excludeposts' => $excludeposts,
  42.             'offset' => $offset,
  43.             //'tags' => '',
  44.             //'content' => 'no',
  45.                         'catlink' => $showcatlink
  46.                     );
  47.  
  48.                echo list_category_posts($atts);
  49.                echo $lcp_result;
  50.         echo $after_widget;
  51.     }
  52.  
  53.     /** @see WP_Widget::update */
  54.     function update($new_instance, $old_instance) {
  55.         return $new_instance;
  56.     }
  57.  
  58.     /** @see WP_Widget::form */
  59.     function form($instance) {
  60.         include('lcp_widget_form.php');
  61.     }
  62. }
  63. add_action('widgets_init', create_function('', 'return register_widget("listCategoryPostsWidget");'));
  64.  
  65. ?>
  66.  
Mar 24 '11 #1
1 2184
dgreenhouse
250 Expert 100+
The easiest way to deal with this is to have 2 paragraphs, 2 divs, or a table with 2 columns. One for the date and the other for the content. That way, the content will always be left aligned without having to worry about fancy alignment methods. It's darn near impossible anyway given most font metrics.

Using a table:
Expand|Select|Wrap|Line Numbers
  1. <table><tr><td><a href="http://subt.net/wordpress/?p=481">03/23</a></td><td><a href="http://subt.net/wordpress/?p=481">Eli Paperboy Reed &amp; The True Loves (17+)</a></td></tr></table>
  2.  
You'd have to work out the vertical alignment.

Obviously with the <p> and <div> elements you'll need some additional css.

I don't remember if using a table is semantically correct, but since it's a block-level element, I believe it is.
Mar 26 '11 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Jonathan | last post by:
I have a specific situation where I am applying padding to text inside of a "P" tag, where if the text wraps then the second line of text ignores the padding. Here is a snippet of what I am doing:...
4
by: sweep | last post by:
Hi there, I have a problem with some CSS I'm writing and I was looking for a little help. I have a nav bar at the top and left side of my page in CSS which work fine. The remaining space has a...
3
by: Ronny Sigo | last post by:
Hello all, Could anybody give me the correct syntax to set the : line indent, top margin cursor position in Ms Word, with VBA ? Thanks !!! Ronny Sigo .... Here's what I have done so far,...
9
by: carl.barrett | last post by:
Hi, Let me explain. I have been given a file that I need to bring into an Access table. Here is a snippet of the file. 100833983 1 MRS M I BATTY 1 000001 00833983
1
by: Joaquim Pinto | last post by:
Hi All, I'm using a richtextbox to find a particular string on a text file. Each line has more then one string separated by comas, like this: 11-11-2004, 08:30:00, 02:56:00, 04:00 I want...
2
by: Sam Martin | last post by:
Hi all, I want to be able to draw wrapped text started at a point x into the rectangle on the first line If there's not a GDI+ method for this, i'm guessing it's a common technique, but can't...
6
by: Adrian Lin | last post by:
Is there a way to read a specfic line in a text file? For instance if I wanted to just read the 5th line is that possible without having to step through the other lines? Essentially I am doing huge...
24
by: John Salerno | last post by:
This is a real small point, but I'd like to hear what others do in this case. It's more an 'administrative' type question than Python code question, but it still involves a bit of syntax. One...
13
by: youngjin.michael | last post by:
Hello, I am new to Python and have one simple question to which I cannot find a satisfactory solution. I want to read text line-by-line from a text file, but want to ignore only the first line....
3
by: astroumut | last post by:
Hi, I need a help regarding reading a line in a text file. I have some files with columns but some header information at the top. Some of these header lines begin with a *, and some of them with...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.