This is gonna be tuff. I have an existing function in my library that querys the db and generates these links depending on the 'bar' field .
**Problem I am making these results fit in to a one line button on a side naviagtion menu example :: www.eriescene.com. the second nav portion is two lines. some of the titles are too long.
**Solution use some kind of regular expression:
1.... starts from the begining of the title and counts in 19 characters
2.... and replaces the next two charcters with .. (two periods).
3.... Forgets about the rest.
[color=#FF9900]Note: Must work on whitespace, letters, numbers, special characters.[/color]
Here is the Existing Link Generating PHP/MYSQL CODE
/////////////////////////////////////////////
//Links to single Events///////////////
///////////////////////////////////////////
function sidemenu($connection) {
global $nav_block;
$table_name = "events";
$sql = "SELECT id, bar FROM $table_name WHERE `date` BETWEEN DATE_SUB(CURDATE(), INTERVAL 1 DAY) and DATE_ADD(CURDATE(), INTERVAL 20 DAY) ORDER BY 'bar'";
$result = @mysql_query($sql) or die(mysql_error());
$num = @mysql_num_rows($result);
if ($num < 1) {
$nav_block = "<p>I am sorry there is no results</p>";
} else {
$nav_block .= "<ul class=\"menu\">";
//if results are found loop through them and make a form selection block list.
while ($row = mysql_fetch_array($result)) {
$id = $row['id'];
$bar = $row['bar'];
$nav_block .= "<li><a href=\"http://www.eriescene.com/index.php?id=$id\">$bar</a></li>";
}
$nav_block .= "</ul>";
}
}
$bar is the variable we'll need to modify. something like
$bar = $preg_replace('findit, limit it and add two period chacters, $bar);
Try as I may stinkin regex's get me everytime. Thank you to anyone that can help me... As I can't get it right and it is way to complicated for my skill level :-) Thanks again