Jump to content

Archived

This topic is now archived and is closed to further replies.

Aftermath

Formatting Text

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]

Share this post


Link to post
Share on other sites
its [b]text-align[/b] not align:

[code]<h6 style="text-align: right;" ...[/code]

Share this post


Link to post
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

Share this post


Link to post
Share on other sites
do you know CSS?
this problem can be solved easily with CSS.
You should post this in the CSS forum, you'll get better help there.

Share this post


Link to post
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 :)

Share this post


Link to post
Share on other sites

×

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.