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


Thread tagged as: Problem

Perch:if limit?

Is there a limit to how many times <perch:if> can be used in a template?

I'm using perch:if extensively to alter the display of a map of the US states. Perch:if exists and perch:if not-exists are used to alter the fill color of the svg for each state and to change what a state links to, as well as changes the title text. It works great, but conks out around Ohio or so and then stops working from there. That sounds suspiciously like a bug on my end but I can't seem to find any. In the source code, </perch:if> statements pop up from about Ohio which causes the map of the remaining states to not display.

Each state follows basically this model:

<perch:if not-exists="OH-centers"> <a xlink:href="/centers/franchise.php"> <perch:else /> <a xlink:href="/centers/ohio.php"> </perch:if> <path id="OH" <perch:if exists="OH-centers"> fill="#51a8ad" <perch:else /> fill="#e7e3e7" </perch:if> d="M731.4,195l-6.1,4.1l-3.9,2.3l-3.4,3.7l-4,3.9l-3.2,0.8l-2.9,0.5l-5.5,2.6l-2.1,0.2l-3.4-3.1 l-5.2,0.6l-2.6-1.5l-2.4-1.4l-4.9,0.7l-10.2,1.6l-7.8,1.2l1.3,14.6l1.8,13.7l2.6,23.4l0.6,4.8l4.1-0.1l2.4-0.8l3.4,1.5l2.1,4.4 l5.1,0l1.9,2.1l1.8-0.1l2.5-1.3l2.5,0.4l2,1.5l1.7-2.1l2.3-1.3l2.1-0.7l0.6,2.7l1.8,1l3.5,2.3l2.2-0.1l1.1-1.1l-0.1-1.4l1.6-1.5 l0.2-5l1-3.9l1.5-1.4l1.5,0.9l0.8,1.2l1.2-0.2l-0.4-2.4l-0.6-0.6v-2.4l1-1.3l2.3-3.4l1.3-1.5l2.1,0.5l2.3-1.6l3.1-3.4l2.3-3.9 l0.2-5.4l0.5-5v-4.7l-1.1-3.1l1-1.5l0.9-1l-1.4-9.8L731.4,195z"/><perch:if exists="OH-centers"><title>Ohio has<br /><perch:content id="OH-centers" type="text" label="Ohio" size="s" maxlength="4" required="false" /> center(s)</title> <perch:else /><title>Franchises available</title> </perch:if> </a>

So that's 2 perch:if exists and 1 perch:if not-exists per state, or roughly 150 such statements for the template. The page loads quickly, but as I mentioned, I start seeing </perch:if> in the source code. Is there a limit to such statements?


Franz Neumann

Franz Neumann 0 points

  • 2 years ago

I added <!--* *--> comments around some of the states to see what happens and it seems that I am hitting some kind of limit. If I comment off out a section of states, this allows other states that didn't show up before (because of </perch:if> statements showing up in the source) to display properly. It just can't handle all 50.

Diagnostics below:


Perch: 2.8.34 Production mode: Production (100) Installed apps: content (2.8.34), assets (2.8.34), categories (2.8.34) DB driver: PDO DB tables: perch2_categories (0), perch2_category_counts (0), perch2_category_sets (0), perch2_content_index (823), perch2_content_items (62), perch2_content_regions (28), perch2_navigation (0), perch2_navigation_pages (0), perch2_page_templates (1), perch2_pages (28), perch2_resource_log (20), perch2_resource_tags (0), perch2_resources (17), perch2_resources_to_tags (0), perch2_settings (16), perch2_user_passwords (0), perch2_user_privileges (26), perch2_user_role_privileges (16), perch2_user_roles (2), perch2_users (1) Users: 1 PHPMailer: 5.2.21 App runtimes: <?php $apps_list = array( 'content', 'categories', ); Editor plug-ins: markitup, redactor H1: b21eca2835195bca2dcc1f7bf6c4758b L1: a08f7ff31bffdbe9aa8bf83ec280e5d5 F1: 6a33f95eca3667f9e0c39bf5ca2980fe headerColour: #ffffff content_singlePageEdit: 0 helpURL: hideBranding: 1 content_collapseList: 0 lang: en-gb update_2.8.34: done latest_version: 2.8.15 on_sale_version: 2.8.34 headerScheme: light siteURL: / content_hideNonEditableRegions: 1 content_frontend_edit: 1 dashboard: 0 hide_pwd_reset: 0 logoPath: /perch/resources/logo.png PERCH_DEVELOPMENT: 10 PERCH_STAGING: 50 PERCH_PRODUCTION: 100 PERCH_DB_USERNAME: ttcweb_www PERCH_DB_SERVER: localhost PERCH_DB_DATABASE: ttcweb_www PERCH_DB_PREFIX: perch2_ PERCH_TZ: America/Los_Angeles PERCH_EMAIL_FROM: franz@copyanddesign.com PERCH_EMAIL_FROM_NAME: Franz Neumann PERCH_LOGINPATH: /perch PERCH_PATH: /home/ttcweb/public_html/perch PERCH_CORE: /home/ttcweb/public_html/perch/core PERCH_RESFILEPATH: /home/ttcweb/public_html/perch/resources PERCH_RESPATH: /perch/resources PERCH_HTML5: 1 PERCH_DEBUG: 1 PERCH_RUNWAY: PERCH_ERROR_MODE: DIE PERCH_DATE_LONG: %d %B %Y PERCH_DATE_SHORT: %d %b %Y PERCH_TIME_SHORT: %H:%M PERCH_TIME_LONG: %H:%M:%S PERCH_RUNWAY_ROUTED: PERCH_STRONG_PASSWORDS: PERCH_PREVIEW_ARG: preview PERCH_TEMPLATE_PATH: /home/ttcweb/public_html/perch/templates PERCH_DEFAULT_DOC: index.php PERCH_DEFAULT_EXT: .php PERCH_PRODUCTION_MODE: 100 PERCH_RWD: PERCH_HTML_ENTITIES: PERCH_SSL: PERCH_STRIPSLASHES: PERCH_PROGRESSIVE_FLUSH: 1 PERCH_PARANOID: PERCH_FORCE_SECURE_COOKIES: PERCH_PASSWORD_MIN_LENGTH: 6 PERCH_MAX_FAILED_LOGINS: 10 PERCH_AUTH_LOCKOUT_DURATION: 1 HOUR PERCH_VERIFY_UPLOADS: PERCH_AUTH_PLUGIN: PERCH_DB_CHARSET: utf8 PERCH_DB_PORT: PERCH_DB_SOCKET: PERCH_SESSION_TIMEOUT_MINS: 20 HOSTING SETTINGS

PHP: 5.4.45 Zend: 2.4.0 OS: Linux SAPI: cgi-fcgi Safe mode: not detected MySQL client: mysqlnd 5.0.10 - 20111026 - $Id: c85105d7c6f7d70d609bb4c000257868a40840ab $ MySQL server: 5.5.54 Free disk space: 21.38 GB Extensions: Core, date, ereg, libxml, openssl, pcre, sqlite3, zlib, bcmath, bz2, calendar, ctype, curl, dom, hash, fileinfo, filter, ftp, gd, gettext, SPL, iconv, json, mbstring, mcrypt, session, standard, mysqlnd, mysqli, PDO, pdo_mysql, pdo_sqlite, Phar, posix, Reflection, mysql, SimpleXML, soap, sockets, exif, tokenizer, xml, xmlreader, xmlrpc, xmlwriter, xsl, zip, cgi-fcgi, ionCube Loader GD: Yes ImageMagick: No PHP max upload size: 200M PHP max form post size: 200M PHP memory limit: 128M Total max uploadable file size: 128M Resource folder writeable: Yes Session timeout: 24 minutes Native JSON: Yes Filter functions: Yes Transliteration functions: No DOCUMENT_ROOT: /home/ttcweb/public_html GATEWAY_INTERFACE: CGI/1.1 HTTP_ACCEPT: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8 HTTP_ACCEPT_ENCODING: gzip, deflate HTTP_ACCEPT_LANGUAGE: en-us HTTP_CONNECTION: keep-alive HTTP_COOKIE: PHPSESSID=i5gm5p1u69ll5oi0evfhf2tfk3; cmsa=1; cmssb=0 HTTP_DNT: 1 HTTP_HOST: dev.tutoringcenter.com HTTP_REFERER: http://dev.tutoringcenter.com/perch/core/settings/diagnostics/ HTTP_UPGRADE_INSECURE_REQUESTS: 1 HTTP_USER_AGENT: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/602.4.8 (KHTML, like Gecko) Version/10.0.3 Safari/602.4.8 PATH: /bin:/usr/bin:/usr/local/php/bin PHPRC: /home/ttcweb QUERY_STRING: extended REDIRECT_STATUS: 200 REMOTE_ADDR: REMOTE_PORT: 46394 REQUEST_METHOD: GET REQUEST_URI: /perch/core/settings/diagnostics/?extended SCRIPT_FILENAME: /home/ttcweb/public_html/perch/core/settings/diagnostics/index.php SCRIPT_NAME: /perch/core/settings/diagnostics/index.php SERVER_ADDR: SERVER_ADMIN: webmaster@tutoringcenter.com SERVER_NAME: dev.tutoringcenter.com SERVER_PORT: 80 SERVER_PROTOCOL: HTTP/1.1 SERVER_SOFTWARE: Apache/2.2.27 (Unix) mod_ssl/2.2.27 OpenSSL/1.0.1e-fips UNIQUE_ID: WK7-5X8AAAEAABXlZsIAAAAC PHP_SELF: /perch/core/settings/diagnostics/index.php REQUEST_TIME_FLOAT: 1487863781.1018 REQUEST_TIME: 1487863781

Just saw that there's a limit in another post, and that Perch 3 will have a 1000 limit. This site should launch within the next two months. Should I be looking at a different solution, or is it likely Perch 3 will be out by then?


Drew McLellan

Drew McLellan 2638 points
Perch Support

The current limit is 100, the new limit is 1000. Perch 3 will be out before 2 months.