I used to use bfarber portal on my 2.3 board and have certain custom blocks, is there anyway of converting them?
This is a sample plugin that gives you a random images from the gallery (but only items that are pinned) useful if you just want to display certain images, any help would be great.
Thanks in advance
Paul
<?php
/*===================================================================
|--------------------------------------------------------------------
|
| Pinned Picture image plugin
|
|
|--------------------------------------------------------------------
===================================================================*/
class pinnedpicture {
function auto_run() {
$this->ipsclass->DB->query("SELECT * FROM ibf_gallery_albums RIGHT JOIN ibf_gallery_images ON ibf_gallery_albums.id=ibf_gallery_images.album_id WHERE pinned=1 ORDER BY RAND() LIMIT 0,1");
if($this->ipsclass->DB->get_num_rows($query) <= 0) {
return '';
} else {
$to_output = "";
while ($row = $this->ipsclass->DB->fetch_row($query)) {
$i_dir = str_replace("//","/","uploads/{$row['directory']}/");
$to_output .= "<b><font color='#800000'>{$row['last_name']}</font></b><br><br><b>{$row['caption']}</b><br>
<a href='{$ibforums->base_url}index.php?automodule=gallery&req=si&img={$row['id']}'><img src='".$i_dir."{$row['masked_file_name']}' alt='{$row['caption']}' width='400'></a><br>
<i>{$row['description']}</i><br>
<br>
<b><a href='{$ibforums->base_url}index.php?automodule=gallery&req=si&img={$row['id']}'>Total Views: {$row['views']}</a> | <a href='{$ibforums->base_url}index.php?act=module&module=gallery&cmd=si&img={$row['id']}'>Total Comments {$row['comments']}</a></b>";
}
}
$collapsed_ids = ','.$this->ipsclass->my_getcookie('collapseprefs').',';
$final['DIV_FO'] = 'show';
$final['DIV_FC'] = 'none';
if ( strstr( $collapsed_ids, ',p_randomimg,' ) )
{
$final['DIV_FO'] = 'none';
$final['DIV_FC'] = 'show';
}
$final['OUTPUT'] = $to_output;
$html = $this->loaditup("pinnedpicture/pinnedpicture_template.html");
$html = $this->parseit($html, $final);
return $html;
}
function loaditup($filename) {
$filename = ROOT_PATH."cfg/portal_plugins/".$filename;
if ( file_exists($filename) ) {
if ( $FH = fopen($filename, 'r') ) {
$template = fread( $FH, filesize($filename) );
fclose($FH);
} else {
echo("Couldn't open the template file");
return '';
}
} else {
echo("Template file does not exist");
return '';
}
return $template;
}
function parseit($temp,$words=array()) {
foreach( $words as $word => $replace)
{
$temp = preg_replace( "/\{$word\}/i", "$replace", $temp );
}
return $temp;
}
}
?>












