Forum

Thread tagged as: Question, Runway

Collection return with Raw and html returning errors...

If I have this:

$item = perch_collection('Items', [
        'skip-template' => true,
        'template' =>'a template.html',
        'filter' => 'slug',
        'match' => 'eq',
        'value' => perch_get('item'),
        'raw' => true
]);

It works. I'm using raw because I need to get latitude and longitude from a map field.

But I would also like to return html, so I'm trying to add return-html:

$item = perch_collection('Items', [
        'skip-template' => true,
        'template' =>'a template.html',
        'return-html' => true,
        'filter' => 'slug',
        'match' => 'eq',
        'value' => perch_get('item'),
        'raw' => true
]);

but I get a bunch of errors...

Should it work to call raw and return-html in the same perch_collection call?

Monty Lewis

Monty Lewis 2 points

  • 3 years ago
Rachel Andrew

Rachel Andrew 394 points
Perch Support

"but I get a bunch of errors..."

which are?

sorry :)

Warning: strpos() expects parameter 1 to be string, array given in /var/www/html/perch/core/runway/apps/content/runtime.php on line 56

Warning: strpos() expects parameter 1 to be string, array given in /var/www/html/perch/addons/apps/perch_members/PerchMembers_Template.class.php on line 11

Warning: preg_match_all() expects parameter 2 to be string, array given in /var/www/html/perch/core/lib/PerchTemplate.class.php on line 284

Warning: mb_strpos() expects parameter 1 to be string, array given in /var/www/html/perch/addons/apps/perch_members/PerchMembers_Template.class.php on line 119

Warning: strpos() expects parameter 1 to be string, array given in /var/www/html/perch/core/lib/PerchTemplate.class.php on line 1508

Warning: strpos() expects parameter 1 to be string, array given in /var/www/html/perch/core/lib/PerchTemplate.class.php on line 1805

Warning: strpos() expects parameter 1 to be string, array given in /var/www/html/perch/core/lib/PerchTemplate.class.php on line 890

Warning: strpos() expects parameter 1 to be string, array given in /var/www/html/perch/core/lib/PerchTemplate.class.php on line 890

Warning: strpos() expects parameter 1 to be string, array given in /var/www/html/perch/core/lib/PerchTemplate.class.php on line 223

Warning: mb_strpos() expects parameter 1 to be string, array given in /var/www/html/perch/core/lib/PerchTemplate.class.php on line 1753

Warning: mb_strpos() expects parameter 1 to be string, array given in /var/www/html/perch/core/lib/PerchTemplate.class.php on line 1753

Warning: mb_strpos() expects parameter 1 to be string, array given in /var/www/html/perch/core/lib/PerchTemplate.class.php on line 1753

Warning: mb_strpos() expects parameter 1 to be string, array given in /var/www/html/perch/core/lib/PerchTemplate.class.php on line 1753

Warning: mb_strpos() expects parameter 1 to be string, array given in /var/www/html/perch/core/lib/PerchTemplate.class.php on line 1753

Warning: mb_strpos() expects parameter 1 to be string, array given in /var/www/html/perch/core/lib/PerchTemplate.class.php on line 1753

Warning: mb_strpos() expects parameter 1 to be string, array given in /var/www/html/perch/core/lib/PerchTemplate.class.php on line 1753

Warning: preg_match_all() expects parameter 2 to be string, array given in /var/www/html/perch/core/lib/PerchTemplate.class.php on line 284

Warning: strpos() expects parameter 1 to be string, array given in /var/www/html/perch/core/lib/PerchTemplate.class.php on line 773

Warning: strpos() expects parameter 1 to be string, array given in /var/www/html/perch/core/lib/PerchTemplate.class.php on line 812

Warning: strpos() expects parameter 1 to be string, array given in /var/www/html/perch/core/lib/PerchTemplate.class.php on line 822

Warning: strpos() expects parameter 1 to be string, array given in /var/www/html/perch/core/lib/PerchTemplate.class.php on line 832

Warning: strpos() expects parameter 1 to be string, array given in /var/www/html/perch/core/lib/PerchTemplate.class.php on line 1498

Warning: strpos() expects parameter 1 to be string, array given in /var/www/html/perch/core/lib/PerchTemplatedForm.class.php on line 79

Warning: strpos() expects parameter 1 to be string, array given in /var/www/html/perch/core/lib/PerchTemplate.class.php on line 1525

Warning: preg_match_all() expects parameter 2 to be string, array given in /var/www/html/perch/core/lib/PerchTemplate.class.php on line 1527

Warning: Illegal string offset 'lat' in /var/www/html/perch/templates/pages/preserves.php on line 12

Warning: Illegal string offset 'lng' in /var/www/html/perch/templates/pages/preserves.php on line 13
Drew McLellan

Drew McLellan 2638 points
Perch Support

Looks like you'll not be able to do that. return-html is designed to work with skip-template.