Wiki Plume Community : DisplayAssociatedLink

HomePage :: Categories :: PageIndex :: RecentChanges :: RecentlyCommented :: Login/Register
noergetmo
getbasd

Display the associated website of a news / Afficher le site internet associé à une brève


By Joss

In manager\inc\class.basicmanager.php change the variable $r = 'SELECT ...' for this one :
Dans manager\inc\class.basicmanager.php changer la variable $r = 'SELECT ...' pour celle-ci :

$r = 'SELECT '.$this->con->pfx.'resources.*,
          '
.$this->con->pfx.'categoryasso.*,
          '
.$this->con->pfx.'categories.*,
          '
.$this->con->pfx.'websites.*,
          '
.$this->con->pfx.'news.news_serial,
          '
.$this->con->pfx.'news.news_titlewebsite,
          '
.$this->con->pfx.'news.news_linkwebsite,
          '
.$this->con->pfx.'news.feed_id
      FROM '
.$this->con->pfx.'resources
      LEFT JOIN '
.$this->con->pfx.'categoryasso ON '.$this->con->pfx.'categoryasso.identifier='.$this->con->pfx.'resources.identifier
      LEFT JOIN '
.$this->con->pfx.'categories ON '.$this->con->pfx.'categoryasso.category_id='.$this->con->pfx.'categories.category_id
      LEFT JOIN '
.$this->con->pfx.'websites ON '.$this->con->pfx.'websites.website_id='.$this->con->pfx.'resources.website_id
      LEFT JOIN '
.$this->con->pfx.'news ON '.$this->con->pfx.'news.resource_id='.$this->con->pfx.'resources.resource_id ';       


Then delete these useless lines :
Puis supprimez ces lignes devenues inutiles :

if ($type == 'news') {
    $r .= ' LEFT JOIN '.$this->con->pfx.'news ON '.$this->con->pfx.'news.resource_id='.$this->con->pfx.'resources.resource_id ';
}


And if you want to display these informations in a $res loop, add this function in manager\frontinc\functions.php
Et si vous voulez afficher ces informations dans une boucle $res, ajoutez cette fonction dans manager\frontinc\functions.php

function pxResAssociatedLink($s = '<a href="%1$s">%2$s</a>')
{
    if (strlen($GLOBALS['_PX_render']['m']->res->f('news_titlewebsite')) > 0) {
        echo sprintf($s, $GLOBALS['_PX_render']['m']->res->f('news_linkwebsite'), $GLOBALS['_PX_render']['m']->res->f('news_titlewebsite'));
    }
}
Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by Wikka Wakka Wiki 1.1.6.1
Page was generated in 0.1295 seconds