Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 14 of 14
  1. #1
    Regular Coder
    Join Date
    Jan 2005
    Posts
    148
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Easy: How to WRAP text?

    How can I make the $ticket_msg wrap???

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

  • #2
    Senior Coder chump2877's Avatar
    Join Date
    Dec 2004
    Location
    the U.S. of freakin' A.
    Posts
    2,773
    Thanks
    19
    Thanked 155 Times in 146 Posts
    If the text is being viewed inside a textarea, then you could have:

    Code:
    <textarea name="message" rows"30" cols="30" wrap="hard"></textarea>
    that's my HTML solution...
    Regards, R.J.

    ---------------------------------------------------------

    Help spread the word! Like my YouTube-to-Mp3 Conversion Script on Facebook !! :)
    [Related videos and tutorials are also available at my YouTube channel and on Dailymotion]
    Get free updates about new software version releases, features, and bug fixes!

  • #3
    Regular Coder
    Join Date
    Jan 2005
    Posts
    148
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  • #4
    Senior Coder chump2877's Avatar
    Join Date
    Dec 2004
    Location
    the U.S. of freakin' A.
    Posts
    2,773
    Thanks
    19
    Thanked 155 Times in 146 Posts
    Regards, R.J.

    ---------------------------------------------------------

    Help spread the word! Like my YouTube-to-Mp3 Conversion Script on Facebook !! :)
    [Related videos and tutorials are also available at my YouTube channel and on Dailymotion]
    Get free updates about new software version releases, features, and bug fixes!

  • #5
    Regular Coder
    Join Date
    Jan 2005
    Posts
    148
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #6
    Senior Coder chump2877's Avatar
    Join Date
    Dec 2004
    Location
    the U.S. of freakin' A.
    Posts
    2,773
    Thanks
    19
    Thanked 155 Times in 146 Posts
    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?
    Last edited by chump2877; 03-12-2005 at 07:12 PM.
    Regards, R.J.

    ---------------------------------------------------------

    Help spread the word! Like my YouTube-to-Mp3 Conversion Script on Facebook !! :)
    [Related videos and tutorials are also available at my YouTube channel and on Dailymotion]
    Get free updates about new software version releases, features, and bug fixes!

  • #7
    Regular Coder
    Join Date
    Jan 2005
    Posts
    148
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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:

    PHP Code:
    $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.

  • #8
    Senior Coder chump2877's Avatar
    Join Date
    Dec 2004
    Location
    the U.S. of freakin' A.
    Posts
    2,773
    Thanks
    19
    Thanked 155 Times in 146 Posts
    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?
    Regards, R.J.

    ---------------------------------------------------------

    Help spread the word! Like my YouTube-to-Mp3 Conversion Script on Facebook !! :)
    [Related videos and tutorials are also available at my YouTube channel and on Dailymotion]
    Get free updates about new software version releases, features, and bug fixes!

  • #9
    Regular Coder
    Join Date
    Jan 2005
    Posts
    148
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I dunno, thats my problem

  • #10
    Senior Coder chump2877's Avatar
    Join Date
    Dec 2004
    Location
    the U.S. of freakin' A.
    Posts
    2,773
    Thanks
    19
    Thanked 155 Times in 146 Posts
    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!
    Last edited by chump2877; 03-12-2005 at 07:27 PM.
    Regards, R.J.

    ---------------------------------------------------------

    Help spread the word! Like my YouTube-to-Mp3 Conversion Script on Facebook !! :)
    [Related videos and tutorials are also available at my YouTube channel and on Dailymotion]
    Get free updates about new software version releases, features, and bug fixes!

  • #11
    Regular Coder
    Join Date
    Jan 2005
    Posts
    148
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I might have found why.... just a second....

  • #12
    Regular Coder
    Join Date
    Jan 2005
    Posts
    148
    Thanks
    0
    Thanked 0 Times in 0 Posts
    nevermind

  • #13
    Senior Coder chump2877's Avatar
    Join Date
    Dec 2004
    Location
    the U.S. of freakin' A.
    Posts
    2,773
    Thanks
    19
    Thanked 155 Times in 146 Posts


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

    ---------------------------------------------------------

    Help spread the word! Like my YouTube-to-Mp3 Conversion Script on Facebook !! :)
    [Related videos and tutorials are also available at my YouTube channel and on Dailymotion]
    Get free updates about new software version releases, features, and bug fixes!

  • #14
    Regular Coder
    Join Date
    Jan 2005
    Posts
    148
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •