if (is_numeric($d['page_number']) && $d['page_number'] > 1) {
    $args['offset'] = ($d['page_number'] - 1) * CCTM::$post_selector['limit'];
}
//print '<pre>'.print_r($args,true).'</pre>'; exit;
// Set pagination tpls
$tpls = array('firstTpl' => '<span class="linklike" onclick="javascript:change_page(1);">&laquo; First</span> &nbsp;', 'lastTpl' => '&nbsp;<span class="linklike" onclick="javascript:change_page([+page_number+]);" >Last &raquo;</span>', 'prevTpl' => '<span class="linklike" onclick="javascript:change_page([+page_number+]);">&lsaquo; Prev.</span>&nbsp;', 'nextTpl' => '&nbsp;<span class="linklike" onclick="javascript:change_page([+page_number+]);">Next &rsaquo;</span>', 'currentPageTpl' => '&nbsp;<span class="post_selector_pagination_active_page">[+page_number+]</span>&nbsp;', 'pageTpl' => '&nbsp;<span class="linklike" title="[+page_number+]" onclick="javascript:change_page([+page_number+]);">[+page_number+]</span>&nbsp;', 'outerTpl' => '<div id="pagination">[+content+] &nbsp; &nbsp;
		Page [+current_page+] of [+page_count+]<br/>
	</div>');
$Q->set_tpls($tpls);
// Get the results
//print '<pre>'.print_r(CCTM::$search_by, true) . '</pre>';
$results = $Q->get_posts($args);
//print '<pre>'.$Q->debug().'</pre>';
$search_form_tpl = CCTM::load_tpl(array('post_selector/search_forms/' . $fieldname . '.tpl', 'post_selector/search_forms/_' . $def['type'] . '.tpl', 'post_selector/search_forms/_default.tpl'));
$Form->set_tpl($search_form_tpl);
$Form->set_name_prefix('');
// blank out the prefixes
$Form->set_id_prefix('');
$d['search_form'] = $Form->generate(CCTM::$search_by, $args);
$item_tpl = '';
$wrapper_tpl = '';
// Multi Field (contains an array of values.
if (isset($def['is_repeatable']) && $def['is_repeatable'] == 1) {
    $item_tpl = CCTM::load_tpl(array('post_selector/items/' . $fieldname . '.tpl', 'post_selector/items/_' . $def['type'] . '_multi.tpl', 'post_selector/items/_relation_multi.tpl'));
    $wrapper_tpl = CCTM::load_tpl(array('post_selector/wrappers/' . $fieldname . '.tpl', 'post_selector/wrappers/_' . $def['type'] . '_multi.tpl', 'post_selector/wrappers/_relation_multi.tpl'));
} else {
    $item_tpl = CCTM::load_tpl(array('post_selector/items/' . $fieldname . '.tpl', 'post_selector/items/_' . $def['type'] . '.tpl', 'post_selector/items/_default.tpl'));
    $wrapper_tpl = CCTM::load_tpl(array('post_selector/wrappers/' . $fieldname . '.tpl', 'post_selector/wrappers/_' . $def['type'] . '.tpl', 'post_selector/wrappers/_default.tpl'));
}
// Placeholders for the wrapper tpl
$hash = array();
 function testGenerate6()
 {
     $Q = new GetPostsForm();
     $Q->set_nonce_field('');
     // override nonce
     $Q->set_css('', false);
     // blank out CSS
     $Q->set_name_prefix('yeti_');
     $actual = $Q->generate();
     $expected = file_get_contents('generated_forms/custom_name_prefix.html');
     $this->assertTrue(in_html($expected, $actual));
 }