I've search into forum several times without find a solution, so i'm gonna explain what i'm looking for.
I'd like to do a search into a certain album, for example now if you search "photo" you'll find all the photos of all the albums that have the word "photo" in their meta. i'd like to have the possibility to do a search of "photo" into just an album, could anybody help me out?
Comments
New in nightly:
`function printSearchForm($prevtext=NULL, $id='search', $buttonSource=NULL, $buttontext='', $iconsource=NULL, $query_fields=NULL, $album_list=NULL)`
Old 1.2.4:
`printSearchForm($prevtext=NULL, $id='search', $buttonSource=NULL,$buttontext='', $iconsource=NULL)`
Thanks for the patient...
The searchform is already in album.php, and i add this
$album_list = array($_zp_current_album->name);
just below the function function printSearchForm()
But it doesn't work...so i'm asking where i have to add the array
Thanks again for the fast reply...
Please read also this: http://www.zenphoto.org/2008/04/how-to-read-the-zenphoto-functions-guide/
`
function printSearchForm($prevtext=NULL, $id='search', $buttonSource=NULL, $buttontext='', $iconsource=NULL, $query_fields=NULL, $album_list=NULL) {
$album_list = array($_zp_current_album->name);
global $_zp_adminJS_loaded;
if(empty($buttontext)) {
$buttontext = gettext("Search");
} else {
$buttontext = sanitize($buttontext);
}
if (checkforPassword(true)) { return; }
$zf = WEBPATH."/".ZENFOLDER;
$dataid = $id . '_data';
$searchwords = (isset($_POST['words']) ? html_encode(sanitize($_REQUEST['words'],0),false) : '');
if (empty($buttonSource)) {
$type = 'submit';
$buttontext = 'value="'.$buttontext.'"';
} else {
$buttonSource = 'src="' . $buttonSource . '" alt="'.$buttontext.'"';
$buttontext = 'title="'.$buttontext.'"';
$type = 'image';
}
if (empty($iconsource)) {
$iconsource = WEBPATH.'/'.ZENFOLDER.'/images/searchfields_icon.png';
}
if (getOption('mod_rewrite')) { $searchurl = '/page/search/'; } else { $searchurl = "/index.php?p=search"; }
$engine = new SearchEngine();
$fields = array_flip($engine->allowedSearchFields());
if (!$_zp_adminJS_loaded) {
$_zp_adminJS_loaded = true;
?>
/js/admin.js">
<?php<br />
}
?>
" id="search_form">
<?php echo $prevtext; ?>
" id="search_input" size="10" />
<?php if(count($fields) > 1) { ?>
" alt="<?php echo gettext('select search fields'); ?>" id="searchfields_icon" />
<?php } ?>
" <?php echo $buttontext; ?> class="pushbutton" id="search_submit" <?php echo $buttonSource; ?> />
" />
<?php<br />
if (count($fields) > 1) {
natcasesort($fields);
$fields = array_flip($fields);
if (is_null($query_fields)) $query_fields = $engine->parseQueryFields();
?>
<?php<br />
foreach ($fields as $key=>$item) {
echo ' "."\n";
}
?>
<?php<br />
}
?>
<?php<br />
}
`
Where have i add the rest of your code?
could you please write me the solution?
in my album.php i add:
<div id="search">
<?php
$album_list = array($_zp_current_album->name);
printSearchForm(NULL, 'search', NULL, 'Seach album', NULL, NULL, $album_list);
?>
while in my template-function.php i have:
function printSearchForm($prevtext=NULL, $id='search', $buttonSource=NULL, $buttontext='', $iconsource=NULL, $query_fields=NULL, $album_list =NULL)
am i in the right way?