Jump to content

shorten the length of a word within a string?


izbryte

Recommended Posts

I have a table that is supposed to be only 400 pixels wide where I'm posting some articles that are pulled out of a mysql database using PHP. Sometimes the articles will contain a really long URL and it pushes the width of my table column so that it's larger than 400 pixels. Is there a way I can control the size of the URL or force it to break and continue on the next line?

Link to comment
Share on other sites

Try locking down your table cell data with

<td width="400">

 

Text should then automatically flow down without blowing out the cell.

 

You might also consider using a replace function to shorten or remove full URLs.

 

Example:

 

raw URL:
http://somesubdomain.someactualdomain.com/a_file_path/file_path_2/theActualFile.php

converted:
<a href="http://somesubdomain.someactualdomain.com/a_file_path/file_path_2/theActualFile.php">http://somesubdomain.someact...</a>

// only http://somesubdomain.someact... will print to the table, anchored with a hyperlink

or

<a href="http://somesubdomain.someactualdomain.com/a_file_path/file_path_2/theActualFile.php">Short Link Description</a>

 

PhREEEk

Link to comment
Share on other sites

  • 2 weeks later...

You should use the second example I gave. Here's your proposed news article:

 

Gehry, Skanska Point

Fingers Over MIT Lawsuit

The suit, filed on October 31 at

Suffolk Superior Court, in

Boston, claims that “Gehry and

Skanska committed design and

construction failures on the

project which caused, among

other things, masonry cracking,

efflorescence, and poor drainage

at (Stata Center’s) outdoor

amphitheater; efflorescence and

mold growth at various locations

on the brick exterior vertical

elevations; Full Article by Sam

Lubell...

 

<td align="left" width="190" valign="middle">
  <b>Gehry, Skanska Point Fingers Over MIT Lawsuit</b>
  <br>
  The suit, filed on October 31 at Suffolk Superior Court, in Boston, claims that “Gehry and Skanska committed design and 
  construction failures on the project which caused, among other things, masonry cracking, efflorescence, and poor drainage 
  at (Stata Center’s) outdoor amphitheater; efflorescence and mold growth at various locations on the brick exterior vertical 
  elevations; <a href="http://archrecord.construction.com/news/daily/archives/071114gehry.asp" target="_blank">Full Article</a>
  by Sam Lubell
  <br>
  <div align="right">
    <a href="http://arkitectum.com/architect-jobs-forum/viewtopic.php?t=64" target="_self" class="small_grn_10">read more...</a>
  </div>
  <hr align="center" size="1" noshade color="#B1C3D9">
</td>

 

PhREEEK

 

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.