djpdjpnl Posted November 19, 2008 Share Posted November 19, 2008 Hi there, I'm sort of stuck with my script. I want to show the last 5 reviews (just the title with a link to it) in the menu on my (e107) website. First I rewritten a plugin that did so, but it didn't show only one category (cat 3 for me). Everything works now and I'm very happy... but...!! All my review titles start with 'REVIEW :: ' so it gets your attention when you read the news on my site. In a menu called 'Reviews' this will be pointless and irritating so I need to erase the first 9 characters from titles in the menu, but not from the database. I found the 'substring' thing when I was talking to my big friend but I don't really get it. If somebody could help me you're the best (wo)man ever! <?php global $sql2, $tp; $obj2 = new convert; $count =5; $curcount =1; $caption = "Reviews"; $no_news = "Geen reviews"; $eol_separator = "</td></tr>"; $sol_separator = "<tr><td valign='top' style='text-align:left; padding-top: 4px;'>"; $qry = "SELECT news_id, news_title, news_category FROM #news WHERE news_render_type = 0 AND news_category = 3 ORDER BY news_id DESC LIMIT 0,".$count; if($sql2->db_Select_gen($qry)) { $n_text = "<table cellspacing='0' cellpadding='0' style='width:100%; border-collapse: collapse;'>"; while ($row = $sql2->db_Fetch()) { $title = $tp->toHTML($row['news_title']); if ($curcount < $count){ $n_text .="<td valign='top' align='left' style='padding-top: 4px;padding-bottom: 4px;border-bottom:1px dotted #CCCCCC;'><a href='".e_HTTP."news.php?item.".$row['news_id']."'>".$title."</a>".$eol_separator; }else{ $n_text .="<td valign='top' align='left' style='padding-top: 4px;'><a href='".e_HTTP."news.php?item.".$row['news_id']."'>".$title."</a>".$eol_separator; } $curcount++; } $n_text .= "</table>"; } else { $n_text = $no_news; } $ns->tablerender($caption, $n_text); Link to comment https://forums.phpfreaks.com/topic/133278-solved-remove-first-characters-of-variable-text/ Share on other sites More sharing options...
djpdjpnl Posted November 19, 2008 Author Share Posted November 19, 2008 I'm sorry. After I woke up just minutes a go, I had an idea that worked. $title = $tp->toHTML(substr($row['news_title'], 10)); Link to comment https://forums.phpfreaks.com/topic/133278-solved-remove-first-characters-of-variable-text/#findComment-693434 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.