Posts by dosa

    Trying to filter a Collection with two filters like this:

    ....the info works, but the template is not found. Should the 'template' line be somewhere else?

    Awesome!! That is was the missing piece. Because the "post_search_result.html" was part of the search, I assumed it was perch:search, not perch:blog. Now I can pull in anything from the post.html and similar template - sweet.


    I really appreciate your persistence in helping me Hussein. Thanks!

    Thanks for that HTML correction. But the elements from the post_search_result.html page aren't connecting, they are still blank.


    This:

    Code
    1. <h2><a href="<perch:search id="result_url" />"><perch:search id="result_title" /></a></h2>
    2. <perch:if exists="result_excerpt" /><p class="excerpt">&hellip;<perch:search id="result_excerpt" encode="false" />&hellip;</p></perch:if>
    3. <p><a href="<perch:search id="result_url" />">
    4. <perch:if exists="result_pageNavText" />
    5. <perch:search id="result_pageNavText" />
    6. <perch:else />
    7. <perch:search id="result_url" />
    8. </perch:if>
    9. </a></p>

    Is resulting in this:

    Code
    1. <h2><a href=""></a></h2>
    2. <p><a href="">
    3. </a></p>

    Ok. The Blog app filter works the same as the from-path, but I've switched it anyway.


    Got it on the self-closing now. Now the search-results.html has:

    ...but the results show like this (with blank spots where the post_search_result.html elements should be). Seems like the layout is not pulling in the right data.

    From the "background:yellow" style, I can see the layout surrounding HTML. But why isn't is showing any perch:search elements? This is the post_search_result.html layout, which is being called on the search-result.html page via the perch:layout, then the layout calls up the post_search_result template which looks like this:


    But as you can see at the top, the content is blank.

    Getting closer. Everything matches your notes, but the results still are not showing.


    1. What is the 'post_search_result.html' page supposed to look like? Just like the search-result.html?
    2. I'm limiting the search to /community (which we call our Blog) so all results all blog-only (which we want). But the results are showing in the regular layout from the search-result.html template. With some testing, I see it's pulling in the post_search_result.php layout, but it's stopping there.
    3. Using Perch Runway 2.8.29 ......does that mean I need ending slashes somewhere?


    My search-result.html page includes:


    My blog_search_result.php page:

    PHP
    1. <?php
    2. perch_blog_custom([
    3. 'template' => 'post_search_result',
    4. 'filter' => 'postURL',
    5. 'value' => perch_layout_var('url', true),
    6. ]);
    7. ?>


    My post_search_result.html page (with some yellow styling so I can see which is which):

    I am missing something here. For the search page, here is the call for the results currently:

    PHP
    1. <?php
    2. $query = perch_get('q');
    3. perch_content_search($query, array(
    4. 'count'=>5,
    5. 'from-path'=>'/community',
    6. 'excerpt-chars'=>300,
    7. // 'template'=>'my_template.html'
    8. ));
    9. ?>

    So where do I add the "post_search_template" I've created? You're suggesting the "perch_blog_custom" element, I've got all the other pieces lined up, but I'm not sure how to do the filtering now. Does the above need to be combined with this below?

    PHP
    1. <?php
    2. perch_blog_custom([
    3. 'template' => 'post_search_result',
    4. 'filter' => 'postURL',
    5. 'value' => perch_layout_var('url', true),
    6. ]);
    7. ?>


    To confirm, I've made the "post_search_result.html" page in the templates/blog folder, which looks like this...

    And finally the "blog_search_result", which is in the templates/layouts/global folder looks like this:

    Where to I put the show all tag? I've tried a few spots, but I don't see anything.


    What if I add an element CMS editors can add to a post that I reference specifically for the search thumbnail. Where would that new region need to go to get it under the search?

    Thanks for the notes. Everything is saved, so that's not it. But I added the showall tag and it indeed shows the ID's I'm looking for.



    So why isn't it filtering the "available" array for the "filter-tags" ID with this call:


    PHP
    1. <?php
    2. perch_content_custom('Listing Cards', [
    3. 'filter'=>'filter-tags',
    4. 'match'=>'eq',
    5. 'value' => 'available',
    6. ]);
    7. ?>

    Ah, I had the filter off when I grabbed that. Whoops. Here is the debug message:

    Code
    1. Debug Message
    2. [1] SELECT * FROM perch2_pages WHERE pagePath='/noho/index.php' LIMIT 1
    3. [14] SELECT regionKey, regionHTML FROM perch2_content_regions WHERE regionPage='/noho/index.php' OR regionPage='*' ORDER BY regionPage DESC
    4. [1] SELECT regionID, regionTemplate, regionPage, regionRev AS rev FROM perch2_content_regions WHERE regionKey='Listing Cards' AND (regionPage='/noho/index.php' OR regionPage='*')
    5. [nil] SELECT * FROM ( SELECT idx.itemID, c.regionID, idx.pageID, c.itemJSON, idx2.indexValue as sortval FROM perch2_content_index idx JOIN perch2_content_items c ON idx.itemID=c.itemID AND idx.itemRev=c.itemRev AND idx.regionID=c.regionID JOIN perch2_content_index idx2 ON idx.itemID=idx2.itemID AND idx.itemRev=idx2.itemRev AND idx2.indexKey='_order' WHERE ((idx.regionID=2020 AND idx.itemRev=688)) AND ((idx.indexKey='filter-tags' AND idx.indexValue='available')) AND idx.itemID=idx2.itemID AND idx.itemRev=idx2.itemRev ) as tbl GROUP BY itemID, pageID, itemJSON, sortval ORDER BY sortval ASC
    6. Using template: /templates/content/listing-card.html

    And this is using this the call:


    PHP
    1. <?php
    2. perch_content_custom('Listing Cards', [
    3. 'filter'=>'filter-tags',
    4. 'match'=>'eq',
    5. 'value' => 'available',
    6. ]);
    7. PerchUtil::output_debug();
    8. ?>

    Ah. Sorry about that. Yes, so the results are returning nothing. With debug on, here is the message:

    Code
    1. Debug Message
    2. [1] SELECT * FROM perch2_pages WHERE pagePath='/noho/index.php' LIMIT 1
    3. [14] SELECT regionKey, regionHTML FROM perch2_content_regions WHERE regionPage='/noho/index.php' OR regionPage='*' ORDER BY regionPage DESC
    4. [1] SELECT regionID, regionTemplate, regionPage, regionRev AS rev FROM perch2_content_regions WHERE regionKey='Listing Cards' AND (regionPage='/noho/index.php' OR regionPage='*')
    5. [55] SELECT * FROM ( SELECT idx.itemID, c.regionID, idx.pageID, c.itemJSON, idx2.indexValue as sortval FROM perch2_content_index idx JOIN perch2_content_items c ON idx.itemID=c.itemID AND idx.itemRev=c.itemRev AND idx.regionID=c.regionID JOIN perch2_content_index idx2 ON idx.itemID=idx2.itemID AND idx.itemRev=idx2.itemRev AND idx2.indexKey='_order' WHERE ((idx.regionID=2020 AND idx.itemRev=688)) AND idx.itemID=idx2.itemID AND idx.itemRev=idx2.itemRev ) as tbl GROUP BY itemID, pageID, itemJSON, sortval ORDER BY sortval ASC
    6. [2] Using template: /templates/content/listing-card.html