Promotional linking MOD and display content on other websites MOD Promotional linking MOD and display content on other websites MOD
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

Promotional linking MOD and display content on other websites MOD

Started by carefree, August 03, 2007, 12:40:56 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

carefree

Allow other webmasters to promote your site with this simple promotional MOD

This code was specificly writen for http://www.free-online-games-central.com you can see a live demo here.
But works on any coppermine site in the same way.

1. Copy the code below anywhere in your template

<p><b>Link to this File!</b><br />
<textarea rows='5' cols='40' style='font-size: 9px; font-family: Verdana;'><a target=_blank href="{CONFIG_DOMAIN}play/{GAME_ID}/">{GAME_NAME}</a></textarea>&nbsp;</p>
<p>Add this File to your website or blog!</b><br /><br />
<textarea rows='20' cols='40' style='font-size: 9px; font-family: Verdana;'>&lt;center&gt;&lt;a target=_blank href="{CONFIG_DOMAIN}play/{GAME_ID}/"&gt;{GAME_NAME}&lt;/a&gt;&lt;br /&gt;&lt;object classid=&quot;clsid:D27CDB6E-AE6D-11cf-96B8-444553540000&quot; codebase=&quot;http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0&quot; width=&quot;{GAME_WIDTH}&quot; height=&quot;{GAME_HEIGHT}&quot;&gt;&lt;param name=&quot;movie&quot; value=&quot;{CONFIG_DOMAIN}games/{GAME_SRC}&quot;&gt;&lt;param name=&quot;quality&quot; value=&quot;high&quot;&gt;&lt;param name=&quot;menu&quot; value=&quot;true&quot;&gt;&lt;embed width=&quot;{GAME_WIDTH}&quot; height=&quot;{GAME_HEIGHT}&quot; src=&quot;{CONFIG_DOMAIN}games/{GAME_SRC}&quot; quality=&quot;high&quot; pluginspage=&quot;http://www.macromedia.com/go/getflashplayer&quot; type=&quot;application/x-shockwave-flash&quot;&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;a target=_blank href=&#039;{CONFIG_DOMAIN}&#039;&gt;{CONFIG_SLOGAN}&lt;/a&gt;&lt;/center&gt;</textarea>


There are 2 parts, you can remove the second section if you dont have flash movies or games, but has the same effect as cmfetch for displaying content on other websites. If your displaying pictures remove all of the flash stuff (...pluginspage=&quot;http://www.macromedia.com/go/getflashplayer&quot; type=&quot;...) etc etc

2. Open funtions.inc.php, find line 691

$template_footer = CPGPluginAPI::filter('gallery_footer','').substr($template, $gallery_pos);

IMMEDIATLY after this add:
/*++++++++++++++++++   Code Modified by Westnblue Network www.simple-scripts-online.com [starts] +++++++++++++++++++++++++++++*/
/*+++++++++ Allow other webmasters to copy a link and add it to thier blog or website. Great promotional and SEO MOD ++++++*/

// Retrieving values from REQUEST

$hostname = "http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
$host =  "http://".$_SERVER['HTTP_HOST'];
$album_id = $_REQUEST['album'];
$pos =  $_REQUEST['pos'];

$template_footer = str_replace('{CONFIG_DOMAIN}play/{GAME_ID}/', $hostname ,$template_footer); // Replacing Variables

/*-------------------  Retrieving The File Id to be displayed -------------------------------*/

if($album_id == 'random')
{
$pid = abs($pos);
}
elseif($album_id == 'lastup')
{
$qry = "select `pid` from cpg1411_pictures order by `pid` desc limit ".$pos.",1";
$get_pid = mysql_query($qry);
$pidval = mysql_fetch_assoc($get_pid);
$pid = $pidval['pid'];
}
else
{
$qry = "select `pid` from cpg1411_pictures where aid='".$album_id."' order by `pid` asc limit ".$pos.",1";
$get_pid = mysql_query($qry);
$pidval = mysql_fetch_assoc($get_pid);
$pid = $pidval['pid'];
}

/*-------------------  Retrieving The File Title to be displayed -------------------------------*/

if(($album_id == 'random')||($album_id == 'lastup'))
{
$get_title= mysql_query("select cpg1411_albums.title as `title` from cpg1411_albums,cpg1411_pictures where cpg1411_pictures.aid = cpg1411_albums.aid and cpg1411_pictures.pid='".$pid."'") or die(mysql_error());
}
else
{
$get_title= mysql_query("select `title` from cpg1411_albums where aid='".$album_id."'") or die(mysql_error());
}
$rowvalue = mysql_fetch_assoc($get_title);

$game_title = $rowvalue['title'];
if($game_title == '')
{
$game_title = "More"; // default
}

$template_footer = str_replace('{GAME_NAME}',$game_title,$template_footer); // Replacing Variables


/*-------------------  Retrieving Various Data corresponding to The File -------------------------------*/


$get_details= mysql_query("select * from cpg1411_pictures  where `pid`='".$pid."'") or die(mysql_error());
$rowvalue1 = mysql_fetch_assoc($get_details);

$req = $host."/albums/games/";
$game_src = $rowvalue1['filename'];
$game_ht = $rowvalue1['pheight'];
$game_wd = $rowvalue1['pwidth'];

// Replacing Variables

$template_footer = str_replace('{GAME_HEIGHT}',$game_ht,$template_footer);
$template_footer = str_replace('{GAME_WIDTH}',$game_wd,$template_footer);
$template_footer = str_replace('{GAME_SRC}',$game_src,$template_footer);
$template_footer = str_replace('{CONFIG_DOMAIN}games/',$req,$template_footer);
$template_footer = str_replace('{CONFIG_DOMAIN}',$host,$template_footer);
$template_footer = str_replace('{CONFIG_NAME}',$host,$template_footer);
$template_footer = str_replace('{CONFIG_SLOGAN}',"LOOK FOR THIS LINE IN FUNCTIONS.INC.PHP TO DISPLAY YOUR SLOGAN",$template_footer);

/*++++++++++++++++++      Code Modified by Westnblue Network www.simple-scripts-online.com [ends]  +++++++++++++++++++++++*/


You wont have to change the variables here, but if you do,  change the code in template.html to suit

There you have it 2 full days of my life on this MOD ::)  Hope you can find it as useful as we have


Joachim Müller

Modifying include/functions.inc.php is not recommended (and not necessary) at all, as it will constantly cause issues when upgrading. Put your code into themes/yourtheme/theme.php instead.

skidpics



Joachim Müller

Don't use this mod then. As I said initially: there are better methods to accomplish what this mod is supposed to do. This mod goes unsupported. There's a reason why this mod has never made it into the mod repository on this forum: because the dev team can't recommend using it.

cip6791

That sounds great. Would you mind sharing one of those methods? I would love to have a feature like this on my gallery. It would help a lot.

Thanks