We are transitioning over to a new forum platform. Please post new issues there. Existing threads will be dealt with here unless you choose to move them over. Visit the new forum

Forum

Thread tagged as: Problem, Error

Warnings thrown when using perch_content_custom

I have a shared multi item region called nurseries which I am using to store the contact details for three nurseries.

I am using content_custom to retrieve the data back and storing as a variable as below:

  // Retrieve nursery data
  $nurseries = perch_content_custom('Nurseries', [
    'template'=>'nursery.html',
    'split-items'=>true,
    'skip-template'=>true,
    'return-html'=>true,
  ], true);

The call works absolutely fine if I remove the skip-template & return-html options although I think it is actually skip-template causing the warnings.

I was after a single call that returned both an array of the data and the individually templated html, so that I could use $nurseries[html][0] and $nurseries['nurseries'][0]['phone'] where required.

Am I going about this a backwards way?

Here's my template:

nursery.html

<perch:content id="email" type="text" label="Email" required="true" suppress="true" order="100" />
<perch:content id="url" type="text" label="URL" replace="http://|, https://|" help="External map URL (optional)" suppress="true" order="110" />
<perch:content id="slug" type="slug" for="name" label="Slug" suppress="true" order="120" />

<p class="nursery-vcard-heading nursery-vcard-heading--<perch:content id="slug" type="slug" />"><perch:content id="name" type="text" label="Name" required="true" title="true" order="1" /></p>
<div class="vcard">
    <div class="adr">
    <p class="street-address"><perch:content id="address1" type="text" label="Address Line 1" required="true" order="2" /></p>
    <p class="street-address"><perch:content id="address2" type="text" label="Address Line 2" required="true" order="3" /></p>
    <p class="city"><perch:content id="locality" type="text" label="Town/City" required="true" order="4" /></p>
    <perch:if exists="url">
        <a href="<perch:content id="url" type="text" />" class="postal-code url"><perch:content id="postcode" type="text" label="Postcode" required="true" order="5" /></a>
    <perch:else />
      <span class="postal-code"><perch:content id="postcode" type="text" /></span>
    </perch:if>
    </div>
    <a href="tel:<perch:content id="phone" type="text" />" class="tel"><perch:content id="phone" type="text" label="Phone" required="true" order="6" /></a>
</div>

Diagnostics

Perch Runway: 3.0.13, PHP: 7.1.8, MySQL: mysqlnd 5.0.12-dev - 20150407 - $Id: b396954eeb2d1d9ed7902b8bae237b287f21ad9e $, with PDO
Server OS: Darwin, apache2handler
Installed apps: content (3.0.13), assets (3.0.13), categories (3.0.13), perch_forms (1.10), chirp_seo (1.2.1), redfinch_logger (1.0.1), boldr (1.0), perch_twitter (4.0)
App runtimes: <?php $apps_list = [ 'perch_forms', 'perch_twitter', 'chirp_seo', 'boldr' ];
PERCH_LOGINPATH: /cms
PERCH_PATH: /Users/Marc/Dropbox (Boldr)/Work/Chestnuts/Online/Website/Build/cms
PERCH_CORE: /Users/Marc/Dropbox (Boldr)/Work/Chestnuts/Online/Website/Build/cms/core
PERCH_RESFILEPATH: /Users/Marc/Dropbox (Boldr)/Work/Chestnuts/Online/Website/Build/cms/assets
Image manipulation: GD
PHP limits: Max upload 32M, Max POST 32M, Memory: 128M, Total max file upload: 32M
F1: 3b606135b33e6a102526838f4152a807
Resource folder writeable: Yes
HTTP_HOST: localhost
DOCUMENT_ROOT: /Users/Marc/Dropbox (Boldr)/Work/Chestnuts/Online/Website/Build
REQUEST_URI: /cms/core/settings/diagnostics/
SCRIPT_NAME: /cms/core/settings/diagnostics/index.php

The warnings being output:

Warning: strpos() expects parameter 1 to be string, array given in /Users/Marc/Dropbox/Work/Chestnuts/Online/Website/Build/cms/core/apps/content/runtime.php on line 75

Warning: strpos() expects parameter 1 to be string, array given in /Users/Marc/Dropbox/Work/Chestnuts/Online/Website/Build/cms/core/lib/PerchTemplate.class.php on line 1508

Warning: strpos() expects parameter 1 to be string, array given in /Users/Marc/Dropbox/Work/Chestnuts/Online/Website/Build/cms/core/lib/PerchTemplate.class.php on line 1805

Warning: strpos() expects parameter 1 to be string, array given in /Users/Marc/Dropbox/Work/Chestnuts/Online/Website/Build/cms/core/lib/PerchTemplate.class.php on line 890

Warning: strpos() expects parameter 1 to be string, array given in /Users/Marc/Dropbox/Work/Chestnuts/Online/Website/Build/cms/core/lib/PerchTemplate.class.php on line 890

Warning: strpos() expects parameter 1 to be string, array given in /Users/Marc/Dropbox/Work/Chestnuts/Online/Website/Build/cms/core/lib/PerchTemplate.class.php on line 223

Warning: mb_strpos() expects parameter 1 to be string, array given in /Users/Marc/Dropbox/Work/Chestnuts/Online/Website/Build/cms/core/lib/PerchTemplate.class.php on line 1753

Warning: mb_strpos() expects parameter 1 to be string, array given in /Users/Marc/Dropbox/Work/Chestnuts/Online/Website/Build/cms/core/lib/PerchTemplate.class.php on line 1753

Warning: mb_strpos() expects parameter 1 to be string, array given in /Users/Marc/Dropbox/Work/Chestnuts/Online/Website/Build/cms/core/lib/PerchTemplate.class.php on line 1753

Warning: mb_strpos() expects parameter 1 to be string, array given in /Users/Marc/Dropbox/Work/Chestnuts/Online/Website/Build/cms/core/lib/PerchTemplate.class.php on line 1753

Warning: mb_strpos() expects parameter 1 to be string, array given in /Users/Marc/Dropbox/Work/Chestnuts/Online/Website/Build/cms/core/lib/PerchTemplate.class.php on line 1753

Warning: mb_strpos() expects parameter 1 to be string, array given in /Users/Marc/Dropbox/Work/Chestnuts/Online/Website/Build/cms/core/lib/PerchTemplate.class.php on line 1753

Warning: mb_strpos() expects parameter 1 to be string, array given in /Users/Marc/Dropbox/Work/Chestnuts/Online/Website/Build/cms/core/lib/PerchTemplate.class.php on line 1753

Warning: preg_match_all() expects parameter 2 to be string, array given in /Users/Marc/Dropbox/Work/Chestnuts/Online/Website/Build/cms/core/lib/PerchTemplate.class.php on line 284

Warning: strpos() expects parameter 1 to be string, array given in /Users/Marc/Dropbox/Work/Chestnuts/Online/Website/Build/cms/core/lib/PerchTemplate.class.php on line 773

Warning: strpos() expects parameter 1 to be string, array given in /Users/Marc/Dropbox/Work/Chestnuts/Online/Website/Build/cms/core/lib/PerchTemplate.class.php on line 812

Warning: strpos() expects parameter 1 to be string, array given in /Users/Marc/Dropbox/Work/Chestnuts/Online/Website/Build/cms/core/lib/PerchTemplate.class.php on line 822

Warning: strpos() expects parameter 1 to be string, array given in /Users/Marc/Dropbox/Work/Chestnuts/Online/Website/Build/cms/core/lib/PerchTemplate.class.php on line 832

Warning: strpos() expects parameter 1 to be string, array given in /Users/Marc/Dropbox/Work/Chestnuts/Online/Website/Build/cms/core/lib/PerchTemplate.class.php on line 1498

Warning: strpos() expects parameter 1 to be string, array given in /Users/Marc/Dropbox/Work/Chestnuts/Online/Website/Build/cms/core/lib/PerchTemplatedForm.class.php on line 79

Warning: strpos() expects parameter 1 to be string, array given in /Users/Marc/Dropbox/Work/Chestnuts/Online/Website/Build/cms/core/lib/PerchTemplate.class.php on line 1525

Warning: preg_match_all() expects parameter 2 to be string, array given in /Users/Marc/Dropbox/Work/Chestnuts/Online/Website/Build/cms/core/lib/PerchTemplate.class.php on line 1527
Marc Sanders

Marc Sanders 0 points

  • 1 year ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

I don't think you can use both skip-template and split-items together.

OK, thank you.