Showing posts with label CodeIgniter. Show all posts
Showing posts with label CodeIgniter. Show all posts

Saturday, March 20, 2010

ReBuild Pagination for Controller on CodeIgniter

this function is using for easily using pagination library in one line.
just insert this function in your controller, and the other function call it:

/**
 * set paging for easy use :)
 * @access private
 * @param string $url
 * @param int $total
 * @param int $perpage
 * @param int $numlink
 * @return void
 */
function setPaging($url='', $total=0, $perpage=20, $numlink=3){
 if(!is_numeric($total)){
  $total=0;
 }
 if(!is_numeric($perpage)){
  $perpage=20;
 }
 if(!is_numeric($numlink)){
  $numlink=3;
 }
 $this->load->library('pagination');
 $segment=explode('/',$url);

Saturday, February 13, 2010

FCKeditor-Javascript and Codeigniter integration

here is the script for your view:
<script src="<?php echo base_url()?>javascripts/fck/fckeditor.js" type="text/javascript">
</script>
<script type="text/javascript">
  window.onload = function(){
    var oFCKeditor = new FCKeditor('isi','100%','300','noUpload');
    oFCKeditor.BasePath = 'javascripts/fck/';
    oFCKeditor.Config['CustomConfigurationsPath'] = oFCKeditor.BasePath+'fckconfig.js?';
    oFCKeditor.Config['SkinPath'] = oFCKeditor.BasePath+'editor/skins/silver/';
    oFCKeditor.ReplaceTextarea();
  }
</script>
........
<form action="<?php echo site_url('admin/post/');?>" method="post">
  <table border="0" cellpadding="0" cellspacing="0">
    <tr><td>
      <textarea cols="70" name="content" rows="15"><?php echo $content;?></textarea>
    </td></tr>
    <tr><th><input type="submit" value="Simpan" /></th></tr>
  </tbody></table>
</form>

thats only simple way