Pull In Testimonials Using perch_content_custom

  • Hi,


    I have the following template -

    Code
    1. <p><perch:content type="textarea" id="testimonial_quote" label="Testimonial Quote" help="Add a testimonial - testimonials will be displayed at random." required="true" editor="markitup"/></p>
    2. <p class="author"><perch:content type="text" id="testimonial_author" label="Testimonial Author" title="true"/></p>

    I'm trying to populate it on my page with perch_content_custom as follows -

    PHP
    1. .testimonials
    2. i.icon-bubbles
    3. |<?php perch_content_custom('Testimonial', array('page'=>'/gallery.php', 'template'=>'testimonial.html', 'sort'=>'author', 'sort-order'=>'RAND', 'count'=>1)
    4. | );?>

    (below is how this .jade is compiled out in the normal .php file -)

    PHP
    1. <div class="testimonials"><i class="icon-bubbles"></i><?php perch_content_custom('Testimonials', array('page'=>'/gallery.php', 'template'=>'_testimonial.html', 'sort'=>'author', 'sort-order'=>'RAND', 'count'=>1) );?> </div>

    gallery.php is where <?php perch_content('Testimonial'); ?> is displayed.


    I'm not sure why nothing is appearing - the content shows fine on gallery.php but the array isn't pulling anything across.


    What's confusing me even more is I have an old project that is JUST using perch_content_custom (the perch region doesn't exist anywhere else on the site) and pulling in from testimonials.html absolutely fine. I've checked and triple checked and nothing is different between the two set ups.


    As above I've tried including the content in another page and pulling it across, as my understanding from the documentation is perch_content_custom alone can't generate a region (thus no idea how I got it working the way I wanted last time?!). Not sure what I'm doing wrong, ideally all I want is to pull in the entered testimonials at random and display within my global page include, but I can pull from a separate testimonials page if needed.


    Any ideas?


    Thank you.

  • drewm

    Approved the thread.
  • I've enabled debug, it outputs the following -


    Debug Message - Perch 3.1.4


    [3]SELECT regionKey, regionHTML FROM perch3_content_regions WHERE regionPage='/index.php' OR regionPage='*' ORDER BY regionPage DESC


    [1]SELECT regionID, regionTemplate, regionPage, regionRev AS rev FROM perch3_content_regions WHERE regionKey='Testimonial' AND (regionPage='/gallery.php' OR regionPage='*')


    [nil]SELECT * FROM ( SELECT idx.itemID, c.regionID, idx.pageID, c.itemJSON, idx2.indexValue as sortval FROM perch3_content_index idx JOIN perch3_content_items c ON idx.itemID=c.itemID AND idx.itemRev=c.itemRev AND idx.regionID=c.regionID JOIN perch3_content_index idx2 ON idx.itemID=idx2.itemID AND idx.itemRev=idx2.itemRev AND idx2.indexKey='author' WHERE ((idx.regionID=93 AND idx.itemRev=2)) AND idx.itemID=idx2.itemID AND idx.itemRev=idx2.itemRev ) as tbl GROUP BY itemID, pageID, itemJSON, sortval, regionID ORDER BY RAND() LIMIT 0, 1


    Using template: \templates\content\_testimonial.html