User Profile
- User
- ebeyrent
- Location
- New Hampton, NH
- Time Zone
- (GMT -5): USA Eastern, Bahamas, Canada Eastern, Colombia, Haiti, Panama
- URL
- http://www.beyrent.net
Recent Articles
Pagination Helper for Long Content
In one of my CMS projects, I ran across a case where the user created a post of very long content that scrolled endlessly down the page. In an effort to make the content more easily readable, I created a Pagination helper that breaks that content into discrete blocks of content with "next" and "prev" links.
- Published by ebeyrent 04/05/07 - 12:59
- 16554 views
- 1 comment







load('Comment/body', 500, 300); ?>
Helper class:
class FckHelper extends HtmlHelper {
var $Width = 500;
var $Height = 300;
function load($id, $width=null, $height=null, $toolbar = 'Default') {
$did = Inflector::camelize(str_replace('/', '_', $id));
if($width){ $this->Width = $width; }
if($height){ $this->Height = $height; }
$js = $this->webroot.'js/';
return<<
var bFCKeditor_$did = new FCKeditor('$did');
bFCKeditor_$did.BasePath = '$js';
bFCKeditor_$did.ToolbarSet = '$toolbar';
bFCKeditor_$did.Width = $this->Width;
bFCKeditor_$did.Height = $this->Height;
bFCKeditor_$did.ReplaceTextarea();
}
fckLoader_$did();
FCK_CODE;
}
function fileBrowserInput($fieldName, $htmlAttributes = array(), $return = false) {
$output = $this->input($fieldName, $htmlAttributes, $return);
if (!isset($htmlAttributes['id'])) {
$htmlAttributes['id'] = $this->model . Inflector::camelize($this->field);
}
$output .= '';
$output .= "// $output .= "function openFileBrowser(id){\n";
$output .= "var fck = new FCKeditor(id);\n";
$output .= "fck.BasePath = '".$this->webroot."js/'\n";
$output .= "var url = fck.BasePath + 'editor/filemanager/browser/default/browser.html?Type=Image&Connector=connectors/php/connector.php';\n";
$output .= "var sOptions = 'toolbar=no,status=no,resizable=yes,dependent=yes,scrollbars=yes';\n";
$output .= "sOptions += ',width=640';\n";
$output .= "sOptions += ',height=480';\n";
$output .= "window.SetUrl = function(fileUrl){\n";
$output .= "\$(id).value = fileUrl;\n";
$output .= "}\n";
$output .= "var oWindow = window.open( url, 'FCKBrowseWindow', sOptions ) ;\n";
$output .= "}\n";
$output .= "//]]>\n";
$output .= '';
$output .= 'select an image...';
return $output;
}
}
?>