Go Back   Webmaster Malaysia Forum » Webmaster Malaysia Community » FeedBack & Suggestion

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 12-02-2007, 09:56 AM
yipguseng's Avatar
Lost Webmaster
 
Join Date: Jan 2007
Location: Petaling Jaya
Posts: 857
Rep Power: 39
yipguseng will become famous soon enough yipguseng will become famous soon enough
Send a message via MSN to yipguseng
capturing hyperlink page's tittle

was been wondering again, sometimes when i enter the url for a page, then when it is display, it will show the title of the target page's title as the anchor name instead of the url, think this is quite nice and cool function....anybody knows how to do it?

and btw, why is it sometimes it capture but sometimes it did not? is it that it can't capture dynamic page title?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 12-02-2007, 10:42 AM
vincevincevince's Avatar
Digital Dream Broker
 
Join Date: Feb 2006
Location: Kuala Lumpur
Posts: 483
Rep Power: 0
vincevincevince can only hope to improve
Send a message via ICQ to vincevincevince Send a message via MSN to vincevincevince Send a message via Skype™ to vincevincevince
PHP Code:
<?php
$post
="here is the post you want to add....";
//1. Recognise the links!
if (preg_match_all("/http[s]?\:\/\/[^ ]+/ism",$post,$matches))
{
  
//loop through matched links
  
foreach ($matches as $link)
  {
    if (
$fh=fopen($link[0],"r"))
      {
      
$p=fread($fh,4096); // 4096 should be enough to get the <title>
      
if ($m=preg_match("/\<title\>(.*?)\<\/title\>",$p)) $post=str_replace($link[0],"<a href=\"$link[0]\">$p[1]</a>");
      }
  }
}
Something like that should work (untested). You will need to edit it if you want to support BBcode as well.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 12-02-2007, 02:22 PM
yipguseng's Avatar
Lost Webmaster
 
Join Date: Jan 2007
Location: Petaling Jaya
Posts: 857
Rep Power: 39
yipguseng will become famous soon enough yipguseng will become famous soon enough
Send a message via MSN to yipguseng
wow cool! thanks man
__________________
Boonage - Freedom is Everything
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 14-04-2007, 01:16 AM
seraphangel's Avatar
Senior Webmaster
 
Join Date: May 2005
Location: penang
Posts: 278
Rep Power: 46
seraphangel is on a distinguished road
Send a message via Yahoo to seraphangel
did you try out the code yip?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
time & date on tittle bar (javascript) fifin04 Website Design 0 11-11-2005 05:47 PM
hyperlink navigation horliks Webmaster Tools 0 27-08-2005 04:44 PM



All times are GMT +8. The time now is 09:52 AM. Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0 vBulletin skin by ForumMonkeys.com.


WebmasterMalaysia.com is Proudly Hosted by Exabytes Semi Dedicated Server.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59