Support » Plugins » Hacks » incorporating search into NextGen gallery using custom search.php

  • I am working with a child theme using the Howling Dog framework. This has it’s own search.php. I need to be able to make images searchable on this site. So far the best of the bad options I have found is to resort to NextGen gallery (I would prefer to use the one provided with core and am open to alternatives) and use the NextGEN Search Engine 0.7.0 plugin ( http://alexrabe.de/2010/01/13/search-for-images/ ). The add-on plugin comes with a pair of search.php files, but I need to incorporate the ngg search code into the HDT search.php child theme file and my php isn’t up to it.
    Following my latest failure the file is currently back to it’s native state at http://www.urbankhutchinsconstruction.com/dev/?s=bathroom

    My apologies in advance if this is too much code. I don’t usually post in this part of the forum.

    This is the code I need to incorporate:

    <?php if ( function_exists( 'ngg_images_results' )  && have_images() )  : ?>
    
    		<h2 class="pagetitle">Image Search Results</h2>
    		<?php ngg_images_results(); ?>
    
    		<?php endif; ?>
    
    	<?php elseif ( function_exists( 'ngg_images_results' )  && have_images() )  : ?>
    
    		<h2 class="pagetitle">Image Search Results</h2>
    		<?php ngg_images_results(); ?>
    
    	<?php else : ?>
    
    		<h2 class="center">No posts found. Try a different search?</h2>
    		<?php get_search_form(); ?>
    
    	<?php endif; ?>

    This is the file I need to customize:

    <?php get_header() ;?>
    
        <?php if (($var['sidebars'] == 'left' || $var['sidebars'] == 'left and right') && ($var['sidebarGroup'] != 'right') ) { get_sidebar('left'); if($var['sidebars'] == 'left and right' && ($var['sidebarGroup'] == 'left')) {get_sidebar('right'); } } ?>
    
        <div id="main" class="equalht">
    
            <div class="main_wrapper">
            <?php if ($var['k9-vision'] == 'on') { ?> <div class="mvtext" style="height:400px">Content Area (<?php echo $var['main_width']; ?>px wide)</div><div class="clear" style="height:280px"></div><?php } else { ?> 
    
            	<?php k9_get_hanger('content/before/');  ?> 
    
    		<?php if (have_posts()) : ?>
    
    			<h2><?php echo $var['search_text']; ?></h2>
    			<?php if($var['show_search_term'] == 'on') : ?><h3>Searched Term: <em><?php echo $_GET['s']; ?></em></h3><?php endif; ?>
    
    			<?php if(function_exists('wp_paginate')) wp_paginate(); else posts_nav_link(); ?>
    
    			<div id="search-results">
    
    				<?php while (have_posts()) : the_post(); ?>
    
    		        	<div class="post_snippet">
    		            <?php if (file_exists( STYLESHEETPATH .'/snippet.php')) {include(STYLESHEETPATH.'/snippet.php');} else {?>
    		                <h2 class="post_title"><a href="<?php echo get_permalink (); ?>" title="Permanent link to <?php the_title_attribute(); ?>" ><?php the_title() ;?></a></h2>
    		                <?php if ($var['post_author'] == 'on') {?><span class="author">Posted by <?php the_author(); ?></span><?php } ?>
    		                <?php if ($var['post_timestamp'] == 'on') {?><span class="timeStamp"><?php if ($var['post_author'] == 'on') {?>on <?php } ?><?php the_time('l, F j, Y'); ?></span><?php } ?>
    		                <div class="clear"></div>
    		                <?php if($var['search_display'] == 'snippet') : ?>
    			                <?php the_excerpt(); ?>
    			            <?php elseif($var['search_display'] == 'full-text') : ?>
    			            	<?php the_content(); ?>
    			           	<?php endif; ?>
    			           	<?php if($var['search_display'] == 'snippet' || $var['search_display'] == 'full-text') : ?><div class="clear"></div><?php endif; ?>
    		                <?php } ?>
    		            </div>
    
    				<?php endwhile; ?>
    				<div class="clear"></div>
    			</div>
    
    			<?php if(function_exists('wp_paginate')) wp_paginate(); else posts_nav_link(); ?>
    
    		<?php else : ?>
    
    			<h2>No posts found. Try a different search?</h2>
    
    		<?php endif; } ?>
    
    			<?php k9_get_hanger('content/after/'); ?>
    
                </div>
    
            </div>
    
        <?php if (($var['sidebars'] == 'right' || $var['sidebars'] == 'left and right') && ($var['sidebarGroup'] != 'left') ) { if($var['sidebars'] == 'left and right' && ($var['sidebarGroup'] == 'right')) {get_sidebar('left'); } get_sidebar('right'); } ?>
    
        <div class="clear"></div>
    
    <?php get_footer();?>

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘incorporating search into NextGen gallery using custom search.php’ is closed to new replies.