Jump to content

[SOLVED] Remove first characters of variable text


djpdjpnl

Recommended Posts

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! :D

 

 

<?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
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.