# Elements transcribing PHP code?

**URL:** <https://forums.realmacsoftware.com/t/elements-transcribing-php-code/46790>\
**Category:** Elements API\
**Created:** [March 19, 2025, 3:15pm UTC](https://forums.realmacsoftware.com/t/elements-transcribing-php-code/46790 "2025-03-19T15:15:20Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![logrunner](https://avatars.discourse-cdn.com/v4/letter/l/59ef9b/32.png) [@logrunner](https://forums.realmacsoftware.com/u/logrunner)\
**Post date:** [March 19, 2025, 3:15pm UTC](https://forums.realmacsoftware.com/t/elements-transcribing-php-code/46790/1 "2025-03-19T15:15:20Z")

</div>

I am continuing the process of trying to migrate my working stand-alone blog to Elements.

Still waiting on a response on how to handle included PHP files. For the moment, I am just moving the files into a folder in the website root folder.

PHP code that is working in the standalone version, isn’t working in Elements because it seems to be transcribed in some way?

```auto
<label class="block cursor-pointer">
<input type="checkbox" name="tags[]" 
value="<?php echo htmlspecialchars($tag); ?>"class="tagCheckbox mr-2"
<?php echo in_array($tag, $tagsFilter) ? 'checked' : ''; ?>
onchange="submitForm()">
<?php echo htmlspecialchars($tag); ?>
</label>

```

Original PHP Code: see above.

```auto
<label class="block cursor-pointer">
<input type="checkbox" name="tags[]"
value="bengal" class="tagCheckbox mr-2"
onchange="submitForm()">
bengal
</label>

```

Correct output shown in browser source for standalone: see above.

```auto
<label class="block cursor-pointer">
<input type="checkbox" name="tags[]"
value="bengal" class="tagCheckbox mr-2"
<!--RW::PHP8RW::PHP-- />
onchange="submitForm()"&gt; 
bengal
</label>

```

Incorrect output shown in browser source for Elements: see above.

Looks like Elements is doing some processing on the PHP?

---

<div class="post-metadata">

**Author:** ![Bill](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/bill/32/107_2.png) [@Bill](https://forums.realmacsoftware.com/u/Bill)\
**Post date:** [March 19, 2025, 4:01pm UTC](https://forums.realmacsoftware.com/t/elements-transcribing-php-code/46790/2 "2025-03-19T16:01:14Z")

</div>

@dan Ah yes, code mutation rears it’s ugly head once again - get the pitch forks out 😉

---

<div class="post-metadata">

**Author:** ![tpbradley](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/tpbradley/32/25503_2.png) [@tpbradley](https://forums.realmacsoftware.com/u/tpbradley)\
**Post date:** [March 20, 2025, 11:25am UTC](https://forums.realmacsoftware.com/t/elements-transcribing-php-code/46790/3 "2025-03-20T11:25:08Z")

</div>

Hey @logrunner,

> [@logrunner](#):
>
> how to handle included PHP files

Have you seen the “Backend” feature we added recently? I think this will help here, you can find the docs for it here [Backend | RapidWeaver Elements Docs](https://docs.realmacsoftware.com/elements-docs/elements-language/bundle-structure/components/templates/backend)

> [@logrunner](#):
>
> Elements is doing some processing on the PHP?

Yes, we process the HTML to ensure everything is correct. I’ve been able to reproduce the issue you’re seeing and have a fix ready in the next build.

---

<div class="post-metadata">

**Author:** ![logrunner](https://avatars.discourse-cdn.com/v4/letter/l/59ef9b/32.png) [@logrunner](https://forums.realmacsoftware.com/u/logrunner)\
**Post date:** [March 20, 2025, 11:42am UTC](https://forums.realmacsoftware.com/t/elements-transcribing-php-code/46790/4 "2025-03-20T11:42:18Z")

</div>

@tpbradley I’ll try the backend; seems like it will resolve my issue. 🙂

I’ll await the fix. 👍

---

<div class="post-metadata">

**Author:** ![logrunner](https://avatars.discourse-cdn.com/v4/letter/l/59ef9b/32.png) [@logrunner](https://forums.realmacsoftware.com/u/logrunner)\
**Post date:** [March 20, 2025, 7:56pm UTC](https://forums.realmacsoftware.com/t/elements-transcribing-php-code/46790/5 "2025-03-20T19:56:02Z")

</div>

@tpbradley, Was this meant to be fixed in 0.67?

I have a line of PHP code that starts like this:

```auto
<input type="text" name="search" value="<?php echo isset($_GET['search']) ? htmlspecialchars($_GET['search']) : ''; ?>" ...

```

and it is getting transcribed to this:

```auto
<input type="text" name="search" value="<!--RW::PHP0RW::PHP-->" ...

```

So it looks like it isn’t fixed yet?

---

<div class="post-metadata">

**Author:** ![tpbradley](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/tpbradley/32/25503_2.png) [@tpbradley](https://forums.realmacsoftware.com/u/tpbradley)\
**Post date:** [March 24, 2025, 9:22am UTC](https://forums.realmacsoftware.com/t/elements-transcribing-php-code/46790/6 "2025-03-24T09:22:47Z")

</div>

Thanks for reporting this, I’ve been able to reproduce it here and looking into it 👍

---

<div class="post-metadata">

**Author:** ![johnhiggins](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/johnhiggins/32/33610_2.png) [@johnhiggins](https://forums.realmacsoftware.com/u/johnhiggins)\
**Post date:** [March 24, 2025, 10:47am UTC](https://forums.realmacsoftware.com/t/elements-transcribing-php-code/46790/7 "2025-03-24T10:47:12Z")

</div>

Hi Tom,

I’ve got the same issue.

My code is…

```auto
<input type="text" name="search" placeholder="Search activities" class="px-3 py-2 border-orange-500 rounded-[3px]" value="<?php echo htmlspecialchars($_GET['search'] ?? ''); ?>">

```

Which is rendered as…

```auto
<input type="text" name="search" placeholder="Search activities" class="px-3 py-2 border-orange-500 rounded-[3px]" value="<!--RW::PHP2RW::PHP-->">

```

Thanks,

John

---

<div class="post-metadata">

**Author:** ![tpbradley](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/tpbradley/32/25503_2.png) [@tpbradley](https://forums.realmacsoftware.com/u/tpbradley)\
**Post date:** [March 24, 2025, 11:44am UTC](https://forums.realmacsoftware.com/t/elements-transcribing-php-code/46790/8 "2025-03-24T11:44:27Z")

</div>

Thanks guys, I’ve just added fixed this! 🎉

---

<div class="post-metadata">

**Author:** ![johnhiggins](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/johnhiggins/32/33610_2.png) [@johnhiggins](https://forums.realmacsoftware.com/u/johnhiggins)\
**Post date:** [March 24, 2025, 12:11pm UTC](https://forums.realmacsoftware.com/t/elements-transcribing-php-code/46790/9 "2025-03-24T12:11:30Z")

</div>

That’s great. Do we have to wait for the next release?

---

<div class="post-metadata">

**Author:** ![tpbradley](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/tpbradley/32/25503_2.png) [@tpbradley](https://forums.realmacsoftware.com/u/tpbradley)\
**Post date:** [March 24, 2025, 12:16pm UTC](https://forums.realmacsoftware.com/t/elements-transcribing-php-code/46790/10 "2025-03-24T12:16:05Z")

</div>

Yes, a new build should be available soon.

---

<div class="post-metadata">

**Author:** ![logrunner](https://avatars.discourse-cdn.com/v4/letter/l/59ef9b/32.png) [@logrunner](https://forums.realmacsoftware.com/u/logrunner)\
**Post date:** [March 24, 2025, 4:58pm UTC](https://forums.realmacsoftware.com/t/elements-transcribing-php-code/46790/11 "2025-03-24T16:58:17Z")

</div>

Thanks @tpbradley - seems like the issued is fixed in 0.6.9. 👍

---

<div class="post-metadata">

**Author:** ![logrunner](https://avatars.discourse-cdn.com/v4/letter/l/59ef9b/32.png) [@logrunner](https://forums.realmacsoftware.com/u/logrunner)\
**Post date:** [March 25, 2025, 11:56am UTC](https://forums.realmacsoftware.com/t/elements-transcribing-php-code/46790/12 "2025-03-25T11:56:59Z")

</div>

Hi @tpbradley Seems this issue is not quite resolved in 0.6.9?

My PHP source code:

```auto
            <!-- Category Dropdown -->
            <select id="category-select" name="category" class="px-3 py-1 border border-gray-400 bg-white text-black rounded hover:border-gray-800 transition appearance-none" onchange="submitForm()">
                <option value="">All Categories</option>
                <?php foreach ($categories as $category): ?>
                    <option value="<?php echo htmlspecialchars($category); ?>" <?php if (isset($_GET['category']) && $_GET['category'] === $category) echo 'selected'; ?>>
                        <?php echo htmlspecialchars($category); ?>
                    </option>
                <?php endforeach; ?>
            </select>

```

The code shown in the browser ‘Show Page Source’ is this:

```auto
 <!-- Category Dropdown -->
  <select id="category-select" name="category" class="px-3 py-1 border border-gray-400 bg-white text-black rounded hover:border-gray-800 transition appearance-none" onchange="submitForm()">
      <option value="">All Categories</option>
      <option value="Bengal" &lt;!--rw::php5rw::php--&gt;> Bengal </option>
      <option value="Burmese" &lt;!--rw::php5rw::php--&gt;> Burmese </option>
      <option value="Cornish Rex" &lt;!--rw::php5rw::php--&gt;> Cornish Rex </option>
      <option value="Persian" &lt;!--rw::php5rw::php--&gt;> Persian </option>
      <option value="Siamese" &lt;!--rw::php5rw::php--&gt;> Siamese </option>
      <option value="Tonkinese" &lt;!--rw::php5rw::php--&gt;> Tonkinese </option>
  </select>

```

I have scanned the browser source for **!–rw** and this is the only area where ‘transcribing’ (if that’s the right word?) is occurring.

---

<div class="post-metadata">

**Author:** ![tpbradley](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/tpbradley/32/25503_2.png) [@tpbradley](https://forums.realmacsoftware.com/u/tpbradley)\
**Post date:** [March 25, 2025, 12:13pm UTC](https://forums.realmacsoftware.com/t/elements-transcribing-php-code/46790/13 "2025-03-25T12:13:09Z")

</div>

Ah yes, I’ve been able to reproduce this here and will try and get a fix in for the next release!

---

<div class="post-metadata">

**Author:** ![tpbradley](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/tpbradley/32/25503_2.png) [@tpbradley](https://forums.realmacsoftware.com/u/tpbradley)\
**Post date:** [March 25, 2025, 7:21pm UTC](https://forums.realmacsoftware.com/t/elements-transcribing-php-code/46790/14 "2025-03-25T19:21:39Z")

</div>

Good news, there’s a fix in the next release that should be available tomorrow 😁

---

<div class="post-metadata">

**Author:** ![logrunner](https://avatars.discourse-cdn.com/v4/letter/l/59ef9b/32.png) [@logrunner](https://forums.realmacsoftware.com/u/logrunner)\
**Post date:** [March 26, 2025, 6:32pm UTC](https://forums.realmacsoftware.com/t/elements-transcribing-php-code/46790/15 "2025-03-26T18:32:21Z")

</div>

Hi @tpbradley - Yes, confirmed fixed in V0.7.0 - Thanks. 😀
