Jump to content
Roych

How to change strategy so that search filtering still works as before (from init.inc to prepend)

Recommended Posts

Hello,

Sorry for the title, didn't really know how to address this post.

This would also probably look like very stupid question, but anyways. ūüėČ
 

So my problem is, that I would like to change strategies from (skyscrapers-profile) init.inc, main.php to direct output strategy (change in config -> prepend.php, append.php) so (without main and func and init files), as I am more familiar without them and don't really need them for my project. I tried to work with it but always get lost in it somehow (not a coder).

When I change the config and got everything working, I can't get the search.php output to work. I'm using skyscraper search.php and search-form.php but I cant get the output to work this way, because some of the functions needed are in func.php file as well.

I need similar filtering on my site like in skyscraper profile. (two page reference field in one article and filter between them - filtering articles between categories) I like the result summary that skyscraper profile has.

 

My search.php

Spoiler

<?php namespace ProcessWire;

/**
 * This template looks for search terms as GET vars and formulates a selector to find matching skyscrapers
 *
 */
    
/** @var WireInput $input */
/** @var Sanitizer $sanitizer */

// most of the code in this template file is here to build this selector string
// it will contain the search query that gets sent to $skyscraperList
$selector = '';

// we use this to store the info that generates the summary of what was searched for
// the summary will appear above the search results
$summary = array(
    "architect" => "", 
    "skupina" => "", 
    "city" => "", 
    "height" => "",
    "floors" => "", 
    "year" => "", 
    "keywords" => "", 
    "brand" => "", 
    );

// if a city is specified, then we limit the results to having that city as their parent
if($input->get('city')) {
    $cityName = $sanitizer->pageName($input->get('city'));
    $city = pages("/cities/$cityName/");
    if($city->id) {
        $selector .= "parent=$city, ";
        $summary['Vrta zasvojenosti'] = $city->title;
        $input->whitelist('Vrta zasvojenosti', $city->name); 
    }
}

// Dodan nov checkbox search

if($input->get->brand) {
    $brands = $input->get->podrocje_select;
    $selector .= "brand=";
    foreach($brands as $brand) {
        $value = $brand;
        $selector .= "$value|";
        $input->whitelist('brand', $value);
    }
}
// END Checkbox search


// added architect
// if a architect is specified, then we limit the results to having that architect (architects field in those pages)
if($input->get->architect) {
    $architect = $pages->get("/architects/" . $sanitizer->pageName($input->get->architect));
    if($architect->id) {
        $selector .= "zasvojenosti_select=$architect, ";//CHANGE YOUR SELECTOR AS SHOWN HERE
    $summary["Zasvojenost:"] = $architect->title;
    $input->whitelist('Zasvojenost:', $architect->name);
    }
}


// added skupine
// if a skupine is specified, then we limit the results to having that architect (architects field in those pages)
if($input->get->skupina) {
    $skupina = $pages->get("/Skupine/" . $sanitizer->pageName($input->get->skupina));
    if($skupina->id) {
        $selector .= "skupine_page_select=$skupina, ";//CHANGE YOUR SELECTOR AS SHOWN HERE
    $summary["skupina:"] = $skupina->title;
    $input->whitelist('skupina:', $skupina->name);
    }
}

// we are allowing these GET vars in the format of 999, 999-9999, or 999+
// so we're using this loop to parse them into a selector
foreach(array('height', 'floors', 'year') as $key) {

    if(!$value = $input->get($key)) continue; 
    
    // see if the value is given as a range (i.e. two numbers separated by a dash)
    if(strpos($value, '-') !== false) {
        list($min, $max) = explode('-', $value); 
        $min = (int) $min;    
        $max = (int) $max; 
        $selector .= "$key>=$min, $key<=$max, ";
        $summary[$key] = (substr($max, 0, 3) == '999') ? "$min and above" : "$min to $max";
        $input->whitelist($key, "$min-$max"); 

    // see if the value ends with a +, which we used to indicate 'greater than or equal to'
    } else if(substr($value, -1) == '+') { 
        $value = (int) $value; 
        $selector .= "$key>=$value, ";
        $summary[$key] = "$value and above";
        $input->whitelist($key, "$value+"); 

    // plain value that doesn't need further parsing
    } else {    
        $value = (int) $value; 
        $selector .= "$key=$value, ";
        $summary[$key] = $value;
        $input->whitelist($key, $value); 
    }
}

// if there are keywords, look in the title and body fields for the words
if($input->get('keywords')) {
    $value = $sanitizer->selectorValue($input->get('keywords'));
    $selector .= "title|body%=$value, "; 
    $summary["keywords"] = $sanitizer->entities($value); 
    $input->whitelist('keywords', $value); 
}

// execute the search
$skyscrapers = findSkyscrapers($selector);

// generate a summary alert that appears at the top of the page, and browser <title> tag
$browserTitle = 'Iskanje - ';

foreach($summary as $key => $value) {
    if($value) {
        $key = ucfirst($key);
        $browserTitle .= ucfirst($key) . ": $value, ";
    } else {
        unset($summary[$key]);
    }
}

region('browserTitle', rtrim($browserTitle, ', '));
region('content',
    files()->render('./includes/search-summary.php', array('items' => $summary)) . 
    renderSkyscraperList($skyscrapers)
);

 

My search-form.php

Spoiler


                            <div class="search-widget">
                                <h3 class="widget-title">Search</h3>
    <form class='uk-form uk-form-stacked' method='get' action='<?php echo $config->urls->root?>search/'>

        <div class='uk-form-row'>
¬†¬† ¬†¬†¬† ¬†¬†¬† ¬†<label class='uk-form-label' for='search_keywords'>Kljuńćne besede</label>
            <div class='uk-form-controls'>
                <input type='text' class='uk-form-width-large' name='keywords' id='search_keywords' value='<?php 
                    if($input->whitelist('keywords')) echo $sanitizer->entities($input->whitelist('keywords')); ?>' />
            </div>
        </div>

        <div class='uk-grid uk-grid-small uk-margin-top'>
        
        
                    <div class='uk-width-1-2'>
                <div class='uk-form-row'>
                    <label class='uk-form-label' for='search_architect'>Ciljna Skupina</label>
                      <select id='search_city' name='skupina' class='uk-form-width-large'>
                        <option value=''>Vse</option><?php 
                        // generate the Architect options, checking the whitelist to see if any are already selected
                          foreach($pages->get("/skupine/")->children() as $skupina) {
                               $selected = $skupina->name == $input->whitelist->skupina ? " selected='selected' " : ''; 
                               echo "<option$selected value='{$skupina->name}'>{$skupina->title}</option>"; 
                          }
                        ?>
                    </select>
                </div>
            </div>
        
        
        
            <div class='uk-width-1-2'>
                <div class='uk-form-row'>
                    <label class='uk-form-label' for='search_architect'>Zasvojenost</label>
                      <select id='search_city' name='architect' class='uk-form-width-large'>
                        <option value=''>Vse</option><?php 
                        // generate the Architect options, checking the whitelist to see if any are already selected
                          foreach($pages->get("/architects/")->children() as $architect) {
                               $selected = $architect->name == $input->whitelist->city ? " selected='selected' " : ''; 
                               echo "<option$selected value='{$architect->name}'>{$architect->title}</option>"; 
                          }
                        ?>
                    </select>
                </div>
            </div>
        
        

            
            <!--
            <div class='uk-width-1-2'>
                <div class='uk-form-row'>
                    <label class='uk-form-label' for='search_height'>Height</label>
                    <div class='uk-form-controls'>
                        <select id='search_height' name='height' class='uk-form-width-large'>
                            <option value=''>Any</option><!?php 
                            // generate a range of heights, checking our whitelist to see if any are already selected
                            foreach(array('0-250', '250-500', '500-750', '750-1000', '1000+') as $range) {
                                $selected = $range == $input->whitelist->height ? " selected='selected'" : '';
                                echo "<option$selected value='$range'>$range ft.</option>";
                            }
                            ?>
                        </select>
                    </div>    
                </div>
            </div>    
        </div>    
        <div class='uk-grid uk-grid-small uk-margin-top'>
            <div class='uk-width-1-2'>
                <div class='uk-form-row'>
                    <label class='uk-form-label' for='search_floors'>Floors</label>
                    <div class='uk-form-controls'>
                        <select id='search_floors' name='floors' class='uk-form-width-large'>
                            <option value=''>Any</option><!?php
                            // generate our range of floors, checking to see if any are already selected
                            foreach(array('1-20', '20-40', '40-60', '60-80', '80+') as $range) {
                                $selected = $range == $input->whitelist->floors ? " selected='selected'" : '';
                                echo "<option$selected value='$range'>$range floors</option>";
                            }
                            ?>
                        </select>
                    </div>    
                </div>
            </div>    
            <div class='uk-width-1-2'>
                <div class='uk-form-row'>
                    <label class='uk-form-label' for='search_year'>Year</label>
                    <div class='uk-form-controls'>
                        <select id='search_year' name='year' class='uk-form-width-large'>
                            <option value=''>Any</option><!?php
                            // generate a range of years by decade, checking to see if any are selected
                            for($year = 1850; $year <= 2010; $year += 10){
                                $endYear = $year+9; 
                                $range = "$year-$endYear";
                                $selected = $input->whitelist->year == $range ? " selected='selected'" : '';
                                echo "<option$selected value='$range'>{$year}s</option>";
                            }
                            ?>
                        </select>
                    </div>
                </div>
            </div>    -->    
        </div>    

        <div class='uk-margin-top'>
            <button type='submit' id='search_submit' class='uk-button uk-button-primary' name='submit' value='1'>
                <i class='uk-icon-search'></i>
                Iskanje
            </button>
        </div>

    </form>
</div>

 

and my func.php

Spoiler


 

<?php namespace ProcessWire;

/***************************************************************************************
 * SHARED SKYSCRAPER FUNCTIONS
 *
 * The following functions find and render skyscrapers are are defined here so that
 * they can be used by multiple template files.
 *
 */

/**
 * Returns an array of valid skyscraper sort properties
 *
 * The keys for the array are the field names
 * The values for the array are the printable labels
 *
 * @return array
 *
 */
function getValidSorts() {
    return array(
        // field => label
        '-images.count' => 'Images (Most)',
        'images.count' => 'Images (Least)',
        'name' => 'Name (A-Z)',
        '-name' => 'Name (Z-A)',
        'parent.name' => 'City (A-Z)',
        '-parent.name' => 'City (Z-A)',
        '-height' => 'Height (Highest)',
        'height' => 'Height (Lowest)',
        '-floors' => 'Floors (Most)',
        'floors' => 'Floors (Least)',
        '-year' => 'Year (Newest)',
        'year' => 'Year (Oldest)',
    );
}

/**
 * Find Skyscraper pages using criteria from the given selector string.
 *
 * Serves as a front-end to $pages->find(), filling in some of the redundant
 * functionality used by multiple template files.
 *
 * @param string $selector
 * @return PageArray
 *
 */
function findSkyscrapers($selector) {

    $validSorts = getValidSorts();

    // check if there is a valid 'sort' var in the GET variables
    $sort = sanitizer('name', input()->get('sort'));

    // if no valid sort, then use 'title' as a default
    if(!$sort || !isset($validSorts[$sort])) $sort = 'name';

    // whitelist the sort value so that it is retained in pagination
    if($sort != 'name') input()->whitelist('sort', $sort);

    // expand on the provided selector to limit it to 10 sorted skyscrapers
    $selector = "template=skyscraper, limit=10, " . trim($selector, ", ");

    // check if there are any keyword searches in the selector by looking for the presence of 
    // ~= operator. if present, then omit the 'sort' param, since ProcessWire sorts by 
    // relevance when no sort specified.
    if(strpos($selector, "~=") === false) $selector .= ", sort=$sort";

    // now call upon ProcessWire to find the skyscrapers for us
    $skyscrapers = pages($selector);

    // save skyscrapers for possible display in a map
    mapSkyscrapers($skyscrapers);

    return $skyscrapers;
}

/**
 * Serves as a place to store and retrieve loaded skyscrapers that will be displayed in a google map.
 *
 * To add skyscrapers, pass in a PageArray of them.
 * To retrieve skyscreapers, pass in nothing and retrieve the returned value.
 *
 * @param null|PageArray $items Skyscraper pages to store
 * @return PageArray All Skyscraper pages stored so far
 *
 */
function mapSkyscrapers($items = null) {
    static $skyscrapers = null;
    if(is_null($skyscrapers)) $skyscrapers = new PageArray();
    if(!is_null($items) && $items instanceof PageArray) $skyscrapers->add($items);
    return $skyscrapers;
}

/**
 * Render the <thead> portion of a Skyscraper list table
 *
 * @return string
 *
 */
function renderSkyscraperListSort() {

    // query string that will be used to retain other GET variables in searches
    input()->whitelist->remove('sort');
    $queryString = input()->whitelist->queryString();
    if($queryString) $queryString = sanitizer('entities', "&$queryString");

    // get the 'sort' property, if it's present
    $sort = input()->get('sort');
    $validSorts = getValidSorts();
    
    // validate the 'sort' pulled from input
    if(!$sort || !isset($validSorts[$sort])) $sort = 'name';

    $options = array();
    $selectedLabel = '';

    // generate options
    foreach($validSorts as $key => $label) {
        if($key === $sort) $selectedLabel = $label;
        $options["./?sort=$key$queryString"] = $label;
    }

    // render output
    $out = files()->render('./includes/skyscraper-list-sort.php', array(
        'options' => $options, 
        'selectedLabel' => $selectedLabel
    ));
    
    return $out;
}

/**
 * Render a list of skyscrapers
 *
 * @param PageArray $skyscrapers Skyscrapers to render
 * @param bool $showPagination Whether pagination links should be shown
 * @param string $headline
 * @return string The rendered markup
 *
 */
function renderSkyscraperList(PageArray $skyscrapers, $showPagination = true, $headline = '') {

    $pagination = '';
    $sortSelect = '';
    $items = array();
    
    if($showPagination && $skyscrapers->count()) {
        $headline = $skyscrapers->getPaginationString('Skyscrapers'); // i.e. Skyscrapers 1-10 of 500
        $pagination = renderPagination($skyscrapers); // pagination links
        $sortSelect = renderSkyscraperListSort();
    }

    foreach($skyscrapers as $skyscraper) {
        $items[] = renderSkyscraperListItem($skyscraper);
    }

    $selector = (string) $skyscrapers->getSelectors();
    if($selector) $selector = makePrettySelector($selector);
    
    $out = files()->render('./includes/skyscraper-list.php', array(
        'skyscrapers' => $skyscrapers, 
        'headline' => $headline, 
        'items' => $items, 
        'pagination' => $pagination, 
        'sortSelect' => $sortSelect, 
        'selector' => $selector
    ));
        
    return $out;
}

/**
 * Render a single skyscraper for presentation in a skyscraper list
 *
 * @param Page $skyscraper The Skyscraper to render
 * @return string
 *
 */
function renderSkyscraperListItem(Page $skyscraper) {

    /** @var Pageimages $images */
    $images = $skyscraper->get('images');

    // make a thumbnail if the first skyscraper image
    if(count($images)) {
        // our thumbnail is 200px wide with proportional height
        $thumb = $images->first()->width(200);
        $img = $thumb->url;

    } else {
        // skyscraper has no images
        $img = config()->urls->templates . "styles/images/photo_placeholder.png";
    }

    // here's a fun trick, set what gets displayed when value isn't available.
    // the property "unknown" is just something we made up and are setting to the page.
    $skyscraper->set('unknown', '??');

    // send to our view file in includes/skyscraper-list-item.php
    $out = files()->render('./includes/skyscraper-list-item.php', array(
        'skyscraper' => $skyscraper,
        'url' => $skyscraper->url,
        'img' => $img, 
        'title' => $skyscraper->title, 
        'architects' => $skyscraper->parent->get("title"),
        'height' => $skyscraper->get('height|unknown'),
        'floors' => $skyscraper->get('floors|unknown'),
        'year' => $skyscraper->get('year|unknown'),
        'summary' => summarizeText($skyscraper->get('body'), 500)
    ));
    
    return $out;
}

/**
 * Render a Google Map using the MarkupGoogleMap module
 * 
 * @param PageArray|null $items
 * @param array $options See header of MarkupGoogleMap.module file for all options
 * @return string
 * 
 */
function renderMap($items = null, array $options = array()) {
    
    static $mapQty = 0;
    $defaults = array(
        'height' => '320px', 
        'useHoverBox' => true,
    );
    
    $options = array_merge($defaults, $options);
    
    if(is_null($items)) {
        if($mapQty) return ''; // if no items given and map has already been rendered, return blank
        $items = mapSkyscrapers(); // otherwise map skyscrapers already listed on the page
    }
    
    $map = page('map');
    $out = '';
    
    if(($map && $map->lat) || count($items)) {
        $mapQty++;
        $map = modules('MarkupGoogleMap');
        if(count($items)) {
            $out .= $map->render($items, 'map', $options);
        } else {
            $out .= $map->render(page(), 'map', $options);
        }
    }
    
    return $out;
}

/**
 * ProcessWire pagination nav for UIkit
 *
 * @param PageArray $items
 * @return string
 *
 */
function renderPagination(PageArray $items) {

    if(!$items->getLimit() || $items->getTotal() <= $items->getLimit()) return '';
    $page = page();
    if(!$page->template->allowPageNum) {
        return "Pagination is not enabled for this template";
    }

    // customize the MarkupPagerNav to output in Foundation-style pagination links
    $options = array(
        'numPageLinks' => 5, 
        'nextItemLabel' => '<i class="uk-icon-angle-double-right"></i>',
        'nextItemClass' => '',
        'previousItemLabel' => '<span><i class="uk-icon-angle-double-left"></i></span>',
        'previousItemClass' => '',
        'lastItemClass' => '',
        'currentItemClass' => 'uk-active',
        'separatorItemLabel' => '<span>&hellip;</span>',
        'separatorItemClass' => 'uk-disabled',
        'listMarkup' => "<ul class='uk-pagination uk-text-left'>{out}</ul>",
        'itemMarkup' => "<li class='{class}'>{out}</li>",
        'linkMarkup' => "<a href='{url}'>{out}</a>",
        'currentLinkMarkup' => "<span>{out}</span>"
    );

    $pager = modules('MarkupPagerNav');
    $pager->setBaseUrl($page->url);

    return $pager->render($items, $options);
}

/**
 * Make the selector better for display readability
 *
 * Since we're displaying the selector to screen for demonstration purposes, this method optimizes the
 * selector is the most readable fashion and removes any parts that aren't necessary
 *
¬†* This is not something you would bother with on a site that wasn't demonstrating a CMS. ūüôā
 * 
 * @param string $selector
 * @return string
 *
 */
function makePrettySelector($selector) {
    if(preg_match('/(architects|parent)=(\d+)/', $selector, $matches)) {
        if($page = pages()->get($matches[2]))
            $selector = str_replace($matches[0], "$matches[1]={$page->path}", $selector);
        if($matches[1] == 'parent') $selector = str_replace("template=skyscraper, ", "", $selector); // template not necessary here
    }
    $selector = sanitizer('entities', $selector);
    $span = "<span class='uk-text-nowrap'>";
    $selector = $span . str_replace(", ", ",</span> $span ", $selector) . "</span>";
    return $selector;
}


/**
 * Generate a summary from the given block of text or HTML and truncate to last sentence
 *
 * @param string $text
 * @param int $maxLength
 * @return string
 *
 */
function summarizeText($text, $maxLength = 500) {

    if(!strlen($text)) return '';
    $summary = trim(strip_tags($text));
    if(strlen($summary) <= $maxLength) return $summary;

    $summary = substr($summary, 0, $maxLength);
    $lastPos = 0;

    foreach(array('. ', '!', '?') as $punct) {
        // truncate to last sentence
        $pos = strrpos($summary, $punct);
        if($pos > $lastPos) $lastPos = $pos;
    }

    if(!$lastPos) {
        // if no last sentence was found, truncate to last space
        $lastPos = strrpos($summary, ' ');
    }

    if($lastPos) {
        $summary = substr($summary, 0, $lastPos + 1); // and truncate to last sentence
    }

    return trim($summary);
}

 

Can this be done at all somehow. Or maybe there is a simpler way to achieve this.

I tried to play and change the skyscraper profile, but got lost as I never worked this way before.

 

Sorry again if this post looks crazy, I just hope someone will understand this post.

Any help is appreciated

Roych

Edited by kongondo
Wrap code in code blocks <>

Share this post


Link to post
Share on other sites
14 hours ago, Roych said:

but I cant get the output to work this way, because some of the functions needed are in func.php file as well.

Just include the func.php file where you need it, I suppose in search.php, at the top.

require_once('path/to/func.php')

 

Share this post


Link to post
Share on other sites

Kongondo thank you for your reply.

I somehow managed to make it work. I had to put both in search.php to make it work.

require_once('./_func.php');
require_once('./_init.php');

and at the end of it I had to put in the echo region('content');  to show me the results.

But now Im struggling to style the search results. I guess I have to put all the styling inside of search.php, but not realy sure how to do that. Everything I try gives me errors.

I think I need to change the echo region('content'); to echo the html of the template I wish.not sure how to do that.  (I guess I won't be needing region after this, or ..?)

Thank you

R

Share this post


Link to post
Share on other sites
On 9/18/2020 at 10:15 AM, Roych said:

I somehow managed to make it work. I had to put both in search.php to make it work.

require_once('./_func.php');
require_once('./_init.php');

Unless you have changed your _init.php or something in this file has changed since I last checked, this is redundant/verbose since the _init.php that ships with ProcessWire already includes _func.php

// Include shared functions
include_once("./_func.php"); 

 

On 9/18/2020 at 10:15 AM, Roych said:

But now Im struggling to style the search results. I guess I have to put all the styling inside of search.php, but not realy sure how to do that.

Why not put them in a .css file?

On 9/18/2020 at 10:15 AM, Roych said:

Everything I try gives me errors.

Hard to read this crystal ball without some sort of clue please? What errors are you getting?

On 9/18/2020 at 10:15 AM, Roych said:

I think I need to change the echo region('content'); to echo the html of the template I wish.not sure how to do that.  (I guess I won't be needing region after this, or ..?)

Are you using this skyscrapers-profile?

Share this post


Link to post
Share on other sites

Yes I'm using this skyscraper profile. and somehow not sure how to work with those regions I read about them but still confused about this. And I have differenet template layouts for pages so it would be easyer for me to work like I'm used to so I can continue my work.

fetching includes to those regions is still a mistery for me.¬†ūüėõ¬†Not so good with those php codes inside so not really even sure what to look for.

All I need is this search (filtering) function to work with prepend strategy. Maybe there is some easyer options for making this kind of article filtering between two page reference field (categories) inside articles, but cant find any good solution.

Thank you

R 

Share this post


Link to post
Share on other sites

Ok I'm lost here and decided I'm actualy willing to pay someone (reasonable price ofc.) to create some working very simple site_profile so it can be reusable if I come to this problem again in the future.¬†ūüėČ

Profile with _prepend, _append strategy simple without func. I need articles page (similar to blog) with two or three page_reference fields inside each article for creating and selecting different categories (each article can belong to more than one category). And with dropdown filtering of all articles on frontend similar to skyscraper profile (filtering between page-reference fields), and with keywords search. Maybe also with navigation to each category article list.

page tree: (can be about anything, just made this up)

BLOG
- article 1 (including 3 pagereference fields with multiple checkboxes(choices))
- article 2 (including 3 pagereference fields with multiple checkboxes(choices))
- article 3 (including 3 pagereference fields with multiple checkboxes(choices))

CATEGORY 1 (Page reference field1)
- cats
- dogs
- birds

CATEGORY 2 (Page reference field2)
- fury
- Feather
- Furr & Feather
- other

CATEGORY 3(Page reference field3)
- something else
- and another

 

that is all ūüėõ

Anyone?¬†ūüėĄ

R

Share this post


Link to post
Share on other sites
8 hours ago, Roych said:

Ok I'm lost here and decided I'm actualy willing to pay someone (reasonable price ofc.)

Better if you post this in the jobs forum.

 

Share this post


Link to post
Share on other sites

Hello

Finaly I have managed to make everything work as I want, the only thing is that now the pagination wont work as it should for filtered results. When you filter the results and if you klick on page2 it shows all of the articles not just the rest of the filtered ones.

The results are filtered between two page-reference fields in one post. pagination is enabled on all templates.

Is there a way to tell pagination to paginate only those filtered results? I tried to look for possibilities on the forum but could't find anything like that.

Thank you in advance

R

 

 

Share this post


Link to post
Share on other sites

I got it, I found the problem in search.php

I got my first site with filtering between multiple pagereference field working, jeeey. So no need for outsourcing, PW is¬†great. ūüėȬ†

Thank you kongondo

R

  • Like 2

Share this post


Link to post
Share on other sites
2 hours ago, Roych said:

I got my first site with filtering between multiple pagereference field working, jeeey.

Great! Glad you got it sorted ūüėĄ.

2 hours ago, Roych said:

I found the problem in search.php

What was the problem in this case?

Thanks.

Share this post


Link to post
Share on other sites
18 minutes ago, kongondo said:

What was the problem in this case?

It was Capital first letter so the page2 URL was different from first page.

Expl:

// added skupine
// if a skupine is specified, then we limit the results to having that skupina (skupine_page_select field in those pages)
if($input->get->skupina) {
    $skupina = $pages->get("/skupine/" . $sanitizer->pageName($input->get->skupina));
    if($skupina->id) {
        $selector .= "skupine_page_select=$skupina, ";//CHANGE YOUR SELECTOR AS SHOWN HERE
//	$summary["Skupina:"] = $skupina->title;
	$input->whitelist('skupina', $skupina->name);
    }
}

¬†the¬†$input->whitelist('skupina', $skupina->name);¬† ¬† ¬†I had the capital letter S it was my mistake. ūüėČ

 

But I do have one question is it possible to output search summary somewhere else than above search results. Not sure how to take it out of the search.php an maybe put it in some includes maybe or ... Right now I commented it out as it is not really necesary but it would be nice to maybe put it somewhere so user can see what they were searching.

I mean this -->c0a71e20bdda51809897560649d3c9ef.png

Thank you

R

Share this post


Link to post
Share on other sites

sorry, misunderstood the question

Edited by dragan

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

√ó
√ó
  • Create New...