Jump to content


Photo

Formatting Text


  • Please log in to reply
4 replies to this topic

#1 Aftermath

Aftermath
  • Members
  • PipPip
  • Member
  • 14 posts

Posted 13 May 2006 - 02:01 PM

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 ^_^

....

 $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 />" ;

....


#2 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 13 May 2006 - 02:12 PM

its text-align not align:

<h6 style="text-align: right;" ...


#3 shenniko

shenniko
  • Members
  • Pip
  • Newbie
  • 6 posts

Posted 13 May 2006 - 02:16 PM

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:-


title--------------------------------------------------------------------------------------------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:-

$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>'; 
}

Shenn

#4 hvle

hvle
  • Members
  • PipPipPip
  • Advanced Member
  • 667 posts
  • Locationmelbourne, Australia

Posted 13 May 2006 - 02:46 PM

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.

Life's too short for arguing.

#5 Aftermath

Aftermath
  • Members
  • PipPip
  • Member
  • 14 posts

Posted 13 May 2006 - 02:47 PM

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 :)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users