How to implement more than one pagination , say two or three on the same page showing different records using Codeigniter. I had tried using the default pagination library but it does not work out.
Would appreciate if this question is answered in detail and using simple explanation(I being a mediocre Programmer)
I haven't done this before, but I guess you could create n-different $configs and use the $this->pagination->initialize(); each time to initialize the paginations.
Something like this (not tested):
$this->load->library('pagination');
$config1['base_url'] = 'http://example.com/index.php/test/page/';
$config1['total_rows'] = 200;
$config1['per_page'] = 20;
$this->pagination->initialize($config1);
echo $this->pagination->create_links();
$config2['base_url'] = 'http://example.com/index.php/test/page/';
$config2['total_rows'] = 200;
$config2['per_page'] = 20;
$this->pagination->initialize($config2);
echo $this->pagination->create_links();
$config3['base_url'] = 'http://example.com/index.php/test/page/';
$config3['total_rows'] = 200;
$config3['per_page'] = 20;
$this->pagination->initialize($config3);
echo $this->pagination->create_links();
Have you checked it?
Related
I'm new to this site and new to Javascript, however I'm been coding in C for some years, and I ran into a problem that totally blows my mind.
I want to make a tool for myself (a very simple code generating tool). I want to generate html code and in a displayable manner, because the final product would be a static page (no javascript). So I tried to solve it with basic string manipulation.
The task and the code is so simple I'll just post it here.
Javascript with it's corresponding tags:
<script>
function ConvertListToGallery()
{
var cont = document.getElementById("gallery_generator_input");
var eof_link;
var eof_title;
var eof_descr;
var lines = [];
var tokens = [];
var i, k;
var result = document.getElementById("gallery_generator_output");
var link;
var lofasz = [];
if(cont)
{
lines = cont.value.split('\n');
lofasz = cont.value.split('"');
console.log(lofasz[0]);
result.innerHTML = "";
for( i = 0; i < lines.length; i++ )
{
tokens = lines[i].split(" + ");
for( k = 0; k < tokens.length; k++ )
{ console.log(tokens[k]); }
link = tokens[0];
result.innerHTML += '<img src=' + link + '/>';
}
document.getElementById("gallery_generator_result").value=result.innerHTML;
document.getElementById("gallery_convert").innerHTML = "Done!";
document.getElementById("gallery_convert").onclick = "";
}
}
</script>
The input:
https://drive.google.com/uc?id=0B3ju3vX1o4OuY0RaaDJKWnlRN1U + title +
desc https://drive.google.com/uc?id=0B3ju3vX1o4OuSC1hNFQwUV9IWlE +
title2 + desc2
And the output after running the script:
<img src="https://drive.google.com/uc?id=0B3ju3vX1o4OuY0RaaDJKWnlRN1U/"><img src="https://drive.google.com/uc?id=0B3ju3vX1o4OuSC1hNFQwUV9IWlE/">
It's like something automatically put quotes around the links. Sorry, I have tried so many things I can't remember now, but as I remember this "auto-quoting" thing only happens with links and it causes all sorts of problem in the resulting code (for example the '/' slips inside the quotes). And all other problems were caused by this behavior (I can't assign title and other attributes inside the img tag).
Additional html:
<form>
<textarea id="gallery_generator_input" style = "width:800px;"></textarea></form>
<div id="gallery_generator_output" style="border:solid; max-height:500px; overflow:auto;">
</div>
<textarea id="gallery_generator_result" style = "width:800px;"></textarea>
<div onclick = "ConvertListToGallery();" id="gallery_convert">Convert!</div>
Thank you for any hints in advance!
EDIT: removed the misleading WOW thing.
The desired result is simply a valid html image code.
Change this line
result.innerHTML += '<img src=' + link + '!!WOW>';
to this
result.innerHTML += '<img src="' + link + '!!WOW"/>';
also you can urlencode the exclamation marks if they are a problem:
result.innerHTML += '<img src="' + link + '%21%21WOW"/>';
Sorry for the late follow-up, but it turned out that writing to the innerHMTL caused the issue (I'm still not sure if writing to innerHTML has some kind of obscure code fixing/completion feature). If I accumulate the HTML in a separate variable THEN assign it to the innerHTML has no issues.
I know that it's not the best practice to make dynamic code like that (the elements don't get added to the DOM tree), but for my use it's simpler to make the code this way, since it's only a tool for me to generate static pages.
I want to turn-off caching functionality in smarty. I have tried using the following code
$smarty->caching = true;
$smarty->cache_lifetime = 120;
But the above code would not work.
How can i turn-off caching.
Thanks in Advance !!
If you want to turn it off, you need to set:
$smart->caching = Smarty::CACHING_OFF;
and not
$smarty->caching = true;
as you showed in your question
I want to remove product status and product dimension tab for products in virtuemart 2
any help?
Try this,
Check the file 'product_edit.php'
administrator\components\com_virtuemart\views\product\tmpl\product_edit.php
And Simply comment the not required tabs
$tabarray = array();
$tabarray['information'] = 'COM_VIRTUEMART_PRODUCT_FORM_PRODUCT_INFO_LBL';
$tabarray['description'] = 'COM_VIRTUEMART_PRODUCT_FORM_DESCRIPTION';
// $tabarray['status'] = 'COM_VIRTUEMART_PRODUCT_FORM_PRODUCT_STATUS_LBL';
// $tabarray['dimensions'] = 'COM_VIRTUEMART_PRODUCT_FORM_PRODUCT_DIM_WEIGHT_LBL';
$tabarray['images'] = 'COM_VIRTUEMART_PRODUCT_FORM_PRODUCT_IMAGES_LBL';
$tabarray['custom'] = 'COM_VIRTUEMART_PRODUCT_FORM_PRODUCT_CUSTOM_TAB';
Hope it works..
I'm trying to make a script that will resize the images in a google doc. What I have is:
var imgs = currentDoc.getImages();
for (var i = 1; i < imgs.length; i++)
{
cell = row.insertTableCell(1);
imgNew = imgs[i].setWidth(365);
cell.insertImage(1, imgNew.getBlob());
}
The image gets inserted correctly but the size does not change regardless of what I set the width to. Since the image is going into a cell (width=370), is it possible to just make the image take up 100% of the width and scale the height proportionally? If not I can deal with manually setting the number of pixels but that is not working either. Any ideas?
The problem is that the image size should be changed after it is inserted to a table. The following code works correctly
function test() {
var doc = DocumentApp.openById('here_is_doc_id');
var imgs = doc.getImages();
var table = doc.getTables()[0];
for (var i = 0; i < imgs.length; i++) {
var row = table.appendTableRow();
var cell = row.insertTableCell(0);
var imgNew = imgs[i].copy();
cell.insertImage(0, imgNew);
imgNew.setWidth(365);
}
}
Please mention, that array indexes, cells numbers, etc. start from 0 and not 1.
Just as an FYI, you don't need to call getBlob()... anything that has a getBlob() can be passed in directly wherever a Blob is needed.
Have you tried:
imgs[i].attr('width', '370');
Or try assigning a class that has width: 100%
When I see the jqgrid demo, the columnnames often on the top of the jqgrid.behind it is the searchtoolbar.Now ,I want to change the position of the cloumnnames and the searchtoolbar.I want to put the searchtoolbar on the top of the jqgrid.
I look at the source code of jqgrid in C#, and I see the JQgridRenderer.cs, but fail to find the code about it.Can anyone help me ?thanks!
You question in not so easy in the implementation.
You can try the following code
var grid = $("#list"), i,
$htableTHead = grid.closest('div.ui-jqgrid-view')
.find('table.ui-jqgrid-htable>thead'),
$lables = $htableTHead.children('tr.ui-jqgrid-labels'),
$thColumn = $lables.children('th'),
$searchToolbar = $htableTHead.children('tr.ui-search-toolbar'),
$thToolbar = $searchToolbar.children('th'),
l = Math.min($thToolbar.length, $thColumn.length),
h = grid[0].grid.headers;
for (i = 0; i < l; i += 1) {
$thToolbar[i].style.cssText = $thColumn[i].style.cssText;
$thColumn[i].style.cssText = "";
h[i].el = $thToolbar[i];
}
$htableTHead.children('tr.ui-search-toolbar').prependTo($htableTHead);
As the result you will have
see the demo here.
It's close to what you want, but if you will try to use sortable: true for example you will receive problems which can't be fixed without changing of some jqGrid code. So I can't grantee that the code above will work in all another situations.