Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3

Thread: Title trim

  1. #1
    New Coder
    Join Date
    Dec 2005
    Location
    Canada
    Posts
    60
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Title trim

    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 Title
    I want to remove everything up to the : and only display what is after it.

    I tried this:

    Code:
    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.
    Attached Files Attached Files

  • #2
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    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:

    PHP Code:
    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

  • #3
    New Coder
    Join Date
    Dec 2005
    Location
    Canada
    Posts
    60
    Thanks
    6
    Thanked 0 Times in 0 Posts
    I got it working using:

    Code:
    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:

    Code:
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •