...

View Full Version : Title trim



geoserv
01-26-2008, 01:57 AM
I have a site where people can submit a website for other members to vote on and visit. Much like Digg.

I have a file (attached) that fetches the URL and makes sure it is valid.

I am trying to limit the URL titles it displays, for example:


Web Site Name: Page TitleI want to remove everything up to the : and only display what is after it.

I tried this:



if(preg_match("'<title>([^<]*?)</title>'", $this->html, $matches)) {
$this->url_title=trim($matches[1]);
list($notused, $strTitle) = explode(":", $this->url_title);
but it didn't make a difference.

Any ideas or suggestion?

Geoserv.

oesxyl
01-26-2008, 03:36 AM
Maybe is stupid, I don't read all code from your attached file, but I see on the top of class Link declaration that you have:



var $url_title = true; // line 20
var $title_url = ''; // line 29


check if you don't use one instead of other, I'm not sure but this seems to be the problem.

I hope this help.

best regards

geoserv
01-26-2008, 04:10 AM
I got it working using:


if(preg_match("'<title>([^<]*?)</title>'", $this->html, $matches)) {
$url_title=trim($matches[1]);
$url_title = explode(":", $url_title);
$this->url_title = $url_title[1];

if I wan ted to add - like we added the :, would I just:


if(preg_match("'<title>([^<]*?)</title>'", $this->html, $matches)) {
$url_title=trim($matches[1]);
$url_title = explode(":" "-", $url_title);
$this->url_title = $url_title[1];

Geoserv.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum