Hi
I am using the ST Octivan Theme http://www.symphonythemes.com/free-drupal-theme/octavin and
I was looking for a file template.tpl.php so I used the "template.php" instead.
Here is my issue. I have a function() that calculates (see below) the total number of results on the results page which works fine on a defferent theme and adding it to the "template.php" file doesn't work.
I have opened the template.php file located on sites/all/themes/sttheme/fusion_core/ and added the following function but no luck.
<?php
function phptemplate_preprocess_search_results(&$variables) {
// define the number of results being shown on a page
$itemsPerPage = 10;
// get the current page
$currentPage = $_REQUEST['page']+1;
// get the total number of results from the $GLOBALS
$total = $GLOBALS['pager_total_items'][0];
// perform calculation
$start = 10*$currentPage-9;
$end = $itemsPerPage * $currentPage;
if ($end>$total) $end = $total;
// set this html to the $variables
$variables['phptemplate_search_totals'] = "Displaying $start - $end of $total results";
}
?>
On my "search-results.tpl.php" page I to print it out but nothing.
<!-- NEW SEARCH RESULTS TOTALS: -->
<?php print $phptemplate_search_totals; ?>
1) My first question is, is the function name phptemplate_preprocess_search_results(&$variables) correct?
I also tried renaming it to "function fusion_core_preprocess_search_results(&$vars)"
2) It seems that the Octivan Theme is not loading the template.php file. Should I create a separate template.tpl.php and put it on the sites/all/themes/sttheme/octivan/ directory instead?
3) Where do I add this function?
Thank you so much.
Ceci
Comments
I believe you'll want to
I believe you'll want to change 'phptemplate' in your function name to the name of your theme.
Ex. octavian_preprocess_search_results();
template.php should be within your theme folder.
I've never heard of a template.tpl.php. It could exist for your theme, but i think you'll need to use template.php.
Be sure to Flush the Cache when you make changes to your themes. Its a good idea.
Hope that helps.
no luck
I renamed the function and nothing.
you are correct...I don't think there is such thing as template.tpl.php.
template.php in /octavian
Do you have a template.php in the octavian theme folder?
I believe your function should be in this file. You could try that.
did that too
Yes, I placed the template.php in the octivan theme folder.
Octivan also has a directory called templates/ where the following files live. I placed the template.php here.
block.tpl.php
search-block-form.tpl.php
node.tpl.php
views-view-field--blog--block--created.tpl.php
page.tpl.php
template.php
Any other idea? I've done this before with other templates but not sure why it won't work with Octivan. :(
Ceci
debug you template.php file.
debug you template.php file. print something in it ?
I have same problem
I tried this functions:
themename_pager() and phptemplate_pager()
http://www.khoobo.com