Area51 @ 4seven.de

Mod Base and Testarea
It is currently 23 Feb 2025, 14:52

All times are UTC + 1 hour




Post new topic TOPIC_LOCKED  [ 1 post ] 
Author Message
PostPosted: 18 Dec 2011, 21:55 
Offline
Tiptop
Tiptop
User avatar

Joined: 11 Feb 2008, 11:49
Posts: 241
Website Title as Link

With this Snippet u can post a link, that automatically shows the link-title of the website as link-description.

Example:

This Link..
Code:
[url_title]http://4seven.bplaced.net/forum/6test/viewtopic.php?f=6&t=116[/url_title]

produces..
[Snippet] Website Title as Link

Screen: follows

Requirement: allow_url_fopen must be activated



Instruction:

1. Make a BBCode

BBCode usage
Code:
[url_title]{URL}[/url_title]


HTML replacement
Code:
{URL}


2. Open

viewtopic.php

Find

Code:
// Output the posts
$first_unread = $post_unread = false;
for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i)
{


Before Add

Code:
// Link as Website Title / 4seven / 2009
function getTitleTag($uwebsite) {   
   $uhtml = implode("", file(html_entity_decode($uwebsite)));
   if (preg_match("/<title>(.*)<\/title>/isU", $uhtml, $utitle)){
   $utitletag = trim($utitle[1]);
   return '<a href="' . $uwebsite . '">' . $utitletag . '</a>';}}
// Link as Website Title / 4seven / 2009


Find

Code:
$message = censor_text($row['post_text']);


After Add

Code:
// Link as Website Title / 4seven / 2009
if((preg_match("#\[url_title:#", $message)) && preg_match("#\[\/url_title:#", $message)){
$message = preg_replace("/\[url_title(.*?)\](.*?)\[\/url_title(.*?)\]/eU", 'getTitleTag("\\2")', $message);}
// Link as Website Title / 4seven / 2009


3. Clear all Caches

_________________
Mod-Bot / Service-Team


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic TOPIC_LOCKED  [ 1 post ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group
[ Time : 0.009s | 21 Queries | GZIP : Off ]