Jump to content

Formatting Text


Aftermath

Recommended Posts

Hello all. This seems to be a relatively simple idea, but I can't get it to work. I have a string and I want part of that string right align. Using <p> doesn't work because I want the text on the same line as the title of the post. And when I use <h6 style="align: right"> my script just won't work.

Below is my string. Any help would be great ^_^

[code]
....

$datestring = $day . $date . $month . "," . $year;
    if ($name && $tag) echo "<u>" . $title . "</u>" . "<h6 style="align: right">" . $datestring . "</h6>" . <"br />" . $newdate . "<br />" . $name . "<br />" . $tag . "<br /><br />" ;

....
[/code]
Link to comment
Share on other sites

Hi Aftermath,

I think waht your trying to do cant be done without the use of Div's/Tables..

What i think your trying to do (correct me if im wrong) is something like below:-


[u]title[/u]--------------------------------------------------------------------------------------------datestring

So the Title is on the left hand side, and the datestring on the right hand side, both on the same line.. With HTML that cant really be done without the use of tables or Div's..

Also with the below code

"<h6 style="align: right">"

PHP might not like it 100% as you are using double quotes within double quotes... if you putting double quotes in a string you should really use single quotes for the start/end of the string.. e.g

'<h6 style="align: right">'

If i was right about the layout your looking for try something like below:-

[code]
$datestring = $day . $date . $month . "," . $year;

if ($name && $tag) {

echo '<table width="100%" align="left"><tr><td><u>' . $title . '</u></td>' . '<td align="right">' . $datestring . '</td></tr><tr><td colspan="2">' . $newdate . '</td></tr><tr><td colspan="2">' . $name . '</td></tr><tr><td>' . $tag . '</td></tr></table>';
}
[/code]

Shenn
Link to comment
Share on other sites

shenniko, you are right about the layout. I tired using single quotations just to test and it is putting the datestring down a line.
So I tested the code you suggested. It works for the fist post but it just piles all the other posts on top of each other. I should have mentioned I am modifing a shout box to be similar to a blog idea.
Thanks for setting me down the right path shenniko :) It seems i just need to have it create mulitple tables now?

hvle, I didnt think I could use css to format a string like that. Thanks for the suggestion. I will look into it :)
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.