...

View Full Version : Easy: How to WRAP text?



techgearfree
03-12-2005, 06:10 PM
How can I make the $ticket_msg wrap???



$view_ticket_table = "<B>On " . $row['date'] . ", you said:</B><BR>" . $ticket_msg . "<BR><BR>";

Thanks

chump2877
03-12-2005, 06:54 PM
If the text is being viewed inside a textarea, then you could have:


<textarea name="message" rows"30" cols="30" wrap="hard"></textarea>

that's my HTML solution... :D

techgearfree
03-12-2005, 06:57 PM
Well, that line of code is part of 'VIEW_TICKET_TABLE' => $view_ticket_table,

In my .tpl file, I call it in by typing {VIEW_TICKET_TABLE} In the tpl file, I have {VIEW_TICKET_TABLE} inside of a table.

I do not really understand what you mean by a textarea. Can I just put that code around the line I pasted before?

Thanks

chump2877
03-12-2005, 07:01 PM
http://www.htmlcodetutorial.com/forms/_TEXTAREA.html

techgearfree
03-12-2005, 07:05 PM
No, I am not using a text area, the table that I am inserting {VIEW_TICKET_TABLE} into just keeps expanding. However, it doesn't have NOWRAP on. Any ideas on how to wrap it, or if the problem is in the php file where I create {VIEW_TICKET_TABLE} or the tpl file where the table is.

chump2877
03-12-2005, 07:10 PM
Text inside tables should automatically wrap.....do you want to force a wrap at a certain point inside a table when table width is set at 100%, for example?

techgearfree
03-12-2005, 07:13 PM
When I just type lines into the table, the text will wrap. The table is 520 px and it wraps so that it doesn't get larger. This is what I would like to happen with the Text that comes into the table from {VIEW_TICKET_TABLE} . However, if a user makes a really long message, then the message ($ticket_msg) will not wrap.

This makes me think I need to put some code into my php line to make the php variable wrap.
My php code is the following:



$ticket_title = htmlspecialchars($row['title']);
$ticket_msg = htmlspecialchars($row['message']);
$view_ticket_table = "<B>On " . $row['date'] . ", you said:</B><BR>" . $ticket_msg . "<BR><BR>";
$topic_id = $row['id'];

if ( $row['status'] == "Open" ) {
$reply_to_ticket_link = "<HR height= 2px width= 80% color=#B8CCDC><a href=\"support_tickets.php?f=reply&id=" . $topic_id . "\"style=\"color:#275078\">Reply to this Support Ticket</a><br>";
}

$sql2 = "SELECT *
FROM ticket_posts WHERE `topic_id` = '$topic_id' ORDER BY id ASC";
if( !($result2 = $db->sql_query($sql2)) )
{
die("Could not query ticket replies information");
}

while ( $row2 = $db->sql_fetchrow($result2) )
{
if ( $row2['user_id'] == $user_id ) {
$said_by = "you";
}
else {
$said_by = "support";
}
$ticket_msg = htmlspecialchars($row2['message']);
$view_ticket_table = $view_ticket_table . "<B>On " . $row2['date'] . ", " . $said_by . " said:</B><BR>" . $ticket_msg . "<BR><BR>";
}

$view_ticket_table = $view_ticket_table . $reply_to_ticket_link;

$tvars = array(
'VIEW_TICKET_TABLE' => $view_ticket_table,
'TICKET_TITLE' => $ticket_title
);
pparse('view_ticket_table');


EDIT: I found this: http://us3.php.net/wordwrap maybe this is what I need? But I was hoping there was an easier way.

chump2877
03-12-2005, 07:17 PM
Before I look at that code:


However, if a user makes a really long message, then the message ($ticket_msg) will not wrap.

Why not?

techgearfree
03-12-2005, 07:20 PM
:D I dunno, thats my problem :D

chump2877
03-12-2005, 07:24 PM
Well I don;t really understand why your text just won;t wrap inside your tbale, but try this for a quick PHP solution:

http://us3.php.net/wordwrap


Edit: Doh, you beat me to it! ;)

techgearfree
03-12-2005, 07:24 PM
I might have found why.... just a second....

techgearfree
03-12-2005, 07:29 PM
nevermind

chump2877
03-12-2005, 07:37 PM
:D

you built me up for the big climax, and then bailed on me....

techgearfree
03-12-2005, 08:05 PM
lol, I think I have it figured out. I used that php code, and it will now wrap. I made it so that if a user for some reason enters in a long message with no spaces like: idfnoasdifsiodfniosfionsdfifisnfoisan, it will still wrap it a a point and it wont mess up the entire page. There is however a down side that some words get cut to the next line.


Thanks for yuor help.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum