Editable text passed into a PHP function
In my PHP page I use a PHP function to encode email addresses so that they are not easily harvested from my pages. My original pages had repeated sections like this:
<div class="staff-member"> <div class="fullname">Firstname Lastname</div> <div class="contact"> <? cryptoMailTo("XXXX@mydomain.edu"); ?> </div> </div>
I would like to make these editable, and repeatable for an unknown number of staff members. I found I was able to make the email address an editable field by simply passing a perch_content() call as an argument to my cryptoMailTo function, like this:
<? cryptoMailTo(perch_content("unique_email_id ")); ?>
This works great for single fields, defined with their own ID. The editable data is passed right into my function. If the staff roster was a fixed size, my problem would be solved. However, I need to make this block of text into a repeatable template which can be used for a variable number of staff members. But since perch templates are HTML files, I don’t see how I can possibly use my php function within the template.
Is there a way to accomplish this?
Perch: 3.0.13, PHP: 7.1.9, MySQL: mysqlnd 5.0.12-dev - 20150407 - $Id: b396954eeb2d1d9ed7902b8bae237b287f21ad9e $, with PDO Server OS: WINNT, apache2handler Installed apps: content (3.0.13), assets (3.0.13), categories (3.0.13) App runtimes: <?php $apps_list = [ ]; PERCH_LOGINPATH: /cms Image manipulation: GD PHP limits: Max upload 2M, Max POST 8M, Memory: 128M, Total max file upload: 2M F1: 3b606135b33e6a102526838f4152a807 Resource folder writeable: Yes HTTP_HOST: wade DOCUMENT_ROOT: D:/WEB/SITES/wade REQUEST_URI: /cms/core/settings/diagnostics/ SCRIPT_NAME: /cms/core/settings/diagnostics/index.php
Want to reply to this thread?Login with Perch