Go Back   Pligg CMS Forum > Pligg Help > Customization Assistance

Reply
 
LinkBack Thread Tools Display Modes
  #11 (permalink)  
Old 04-13-2008, 07:30 PM
Banned
Pligg Version: 9.8.
Pligg Template: Custom
 
Join Date: Feb 2007
Location: Canada
Posts: 849
Thanks: 74
Thanked 49 Times in 45 Posts
I still haven't figured this one out.

Geoserv.
Reply With Quote
The Following User Says Thank You to Geoserv For This Useful Post:
  #12 (permalink)  
Old 04-16-2008, 11:58 PM
New Pligger
 
Join Date: Jul 2007
Posts: 6
Thanks: 1
Thanked 1 Time in 1 Post
Ok, I think I've got it.

Many thanks to Geoserv who did all the hard work by coming up with the basis of this.

Find this line in the ./lib/link.php
PHP Code:
if(preg_match("'<title>([^<]*?)</title>'"$this->html$matches)) {
            
$this->url_title=trim($matches[1]);
        } 
Add his modified code shown below just after that line.

PHP Code:
if ( preg_match '~<meta(.+?)name="description"(.+?)>~i'$this->html$matches ) ){
$description preg_replace'~^(.+?)content="([^"]+?)"(.+?)$~i''$2'$matches[1].$matches[2] );
$descriptionstr_replace("content=\""" "trim($description));
$descriptionstr_replace("\""" "trim($description));
$this->content=$description;

Since my regex is weak, I did a string replace to get rid of the 'content="' and the final quote mark he was having trouble with. I took that and made a smarty variable out of it.

Save your ./lib/link.php

Now open the ./submit.php
find this line (around line #167 / 168 depending on other modifications)

PHP Code:
$main_smarty->assign('submit_url_title'$linkres->url_title); 
Under it add...

PHP Code:
$main_smarty->assign('submit_content'$linkres->content); 
Save your submit.php

Now if the site being submitted has a meta description tag, it should show by default in the description box on step two of submit. If the user wants to add or change it, the updated description will be saved and not the meta description.

Hope this helps someone out there!
Reply With Quote
The Following User Says Thank You to knight01 For This Useful Post:
  #13 (permalink)  
Old 08-19-2008, 07:39 AM
New Pligger
 
Join Date: Jun 2008
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Hi knight01,

I applied your instructions, but the article details (story title, description) are still blank ;-(

The modified code looks as follows:


var/www/libs/link.php

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

if ( preg_match ( '~<meta(.+?)name="description"(.+?)>~i', $this->html, $matches ) ){
$description = preg_replace( '~^(.+?)content="([^"]+?)"(.+?)$~i', '$2', $matches[1].$matches[2] );
$description= str_replace("content=\"", " ", trim($description));
$description= str_replace("\"", " ", trim($description));
$this->content=$description;
}


var/www/submit.php

if(isset($url)){
$main_smarty->assign('submit_url', $url);
} else {
$main_smarty->assign('submit_url', '');
}
$main_smarty->assign('submit_url_title', $linkres->url_title);

$main_smarty->assign('submit_content', $linkres->content);


I would be deeply grateful for any help.

Max
Reply With Quote
  #14 (permalink)  
Old 08-21-2008, 10:38 AM
New Pligger
 
Join Date: Jun 2008
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
... do i have to change more than these two files?

btw, also the area “URL Title” is blank … is that normal?

Regards
Max
Reply With Quote
Reply

Thread Tools
Display Modes
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 Off
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Similar Threads
Thread Thread Starter Forum Replies Last Post
New story gets auto discarded with zero votes envieme General Help 4 11-19-2008 08:14 PM
Pligg auto tagging script. kazey Modification Tutorials 30 05-09-2008 02:37 PM
RSS Auto Import? KState General Help 6 02-21-2008 05:54 AM
I'm looking for : Auto Sitemaps for pligg l2aelba Modification Tutorials 4 12-05-2007 01:48 AM
auto fill tags and description from source URL chad90382 Modification Tutorials 1 11-06-2006 09:04 AM


Search Engine Friendly URLs by vBSEO 3.2.0