On The Web by Ircmaxell
GNU/GPL PageCache Joomla! APC php5 Lighttpd! Redhat
Home arrow Forum
Saturday, 17 May 2008
 
 
Featured Site
Main Menu
Home
Articles
Services
Portfolio
Version Information
Bug Tracker
F.A.Q.
Downloads
Forum
Contact Us
Text Link Ads
Latest Version
Feed Icon Page Cache 1.0.8 stable
Release Date: 2007-06-11
Donate!
Login
Syndicate
On The Web Forums
Welcome, Guest
Please Login or Register.
Lost Password?
Re:Digg bot (1 viewing)
_GEN_GOTOBOTTOM Post Reply

TOPIC: Re:Digg bot

#892
SilentKillzr (User)
Fresh Boarder
Posts: 1
graphgraph
Click here to see the profile of this user
Digg bot 2007/07/27 01:58 Karma: 0  
well i know you didn't make it, but i thought you could help me,

well i have a diggbot and it shows the digg on the content viewed, when you sumbit there is a digg_title function so it auto inserts the title i made this work using getPageTitle(); but i want to remove the site title so its just the article. how would i do this?

diggbot script:
<?php
/**
* DiggBot
* www.chadbrantly.com
*
* @package DiggBot
* @copyright (C)2007 Chad Brantly
* @license GNU/GPL
*
**/


// no direct access
defined( '_VALID_MOS' ) or die( 'Restricted access' );

global $mosConfig_lang, $mosConfig_absolute_path;

$_MAMBOTS->registerFunction( 'onPrepareContent', 'botShowDigg' );
/*$_MAMBOTS->registerFunction( 'onBeforeDisplayContent', 'botShowDigg' );*/

function botShowDigg( $published, &$row, &$params, $page=0 ) {
global $_MAMBOTS, $mosConfig_live_site, $database, $Itemid;

if( $published && isset($row->title_alias) ) {
$query = "SELECT params"
. "n FROM jos_mambots"
. "n WHERE element = 'diggbot'"
. "n AND folder = 'content'"
;
$database->setQuery( $query );
$database->loadObject($mambot);

$query = "SELECT id "
. "n FROM `jos_menu` "
. "n WHERE `menutype`='mainmenu'"
. "n AND `published` =1"
. "n ORDER BY `ordering` ASC "
. "n LIMIT 0, 1 ";
$database->setQuery( $query );
$frontpage_id = $database->loadResult();

$botParams = new mosParameters( $mambot->params );
$frontpage = $botParams->def( 'frontpage', 0 );

if( $Itemid != $frontpage_id || $frontpage ) {

ob_start(); ?>
<?php global $mainframe;
if($mainframe->getCustomPathWay){
$pageTitle = $mainframe->getCustomPathWay;
}else{
$pageTitle = $mainframe->getPageTitle();
}
?>
<div style="float:right; margin-left:8px;">
<script type="text/javascript">
digg_url = "<?php echo $site.diggbot_buildLink($row->id); ?>";
digg_title = "<?php echo $pageTitle ?>";
</script>
<script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script>
</div>
<?php
$html = ob_get_contents();
ob_end_clean();

$row->text = $html.$row->text;
}
}

return true;
}

// build the link to the content item given its id
function diggbot_buildLink($contentid) {
$link = '';
if ($contentid) {
$Itemid = diggbot_getItemId($contentid);

// Blank itemid checker for SEF
if ($Itemid == NULL) {
$Itemid = '';
} else {
$Itemid = '&Itemid='. $Itemid;
}

$link = sefRelToAbs( 'index.php?option=com_content&task=view&id='. $contentid . $Itemid );
}
return $link;
}

// get the itemid for content item given its id
function diggbot_getItemId($id) {
global $database, $mainframe;

// get itemid if contentitem in menu
$query = "select id from jos_menu where published = '1' and (type = 'content_item_link' OR type = 'content_typed') and componentid='$id';";
$database->setQuery( $query );
$Itemid = $database->loadresult();

if (!$Itemid) {
// needed to reduce queries used by getItemid
$bs = $mainframe->getBlogSectionCount();
$bc = $mainframe->getBlogCategoryCount();
$gbs = $mainframe->getGlobalBlogSectionCount();
// get Itemid
$Itemid = $mainframe->getItemid( $id, 0, 0, $bs, $bc, $gbs );
}
return $Itemid ? $Itemid : 0;
}



?>
somthin
  The administrator has disabled public write access.
#896
ircmaxell (Admin)
Admin
Posts: 444
graph
Click here to see the profile of this user
Re:Digg bot 2007/07/27 06:30 Karma: 8  
Well, what you could do is something like this
Code:

  }else{ $pageTitle $mainframe->getPageTitle(); if(strpos($pageTitle,$mosConfig_sitename)!==false$pageTitle str_replace($mosConfig_sitename''$pageTitle); } 

  The administrator has disabled public write access.
_GEN_GOTOTOP Post Reply
get the latest posts directly to your desktop
Loans - Mortgages - Loans - Credit Counseling
 
Top! Top!
Generated in 0.18019509315491 Seconds