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?
<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.
<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.
<label class="block cursor-pointer">
<input type="checkbox" name="tags[]"
value="bengal" class="tagCheckbox mr-2"
<!--RW::PHP8RW::PHP-- />
onchange="submitForm()">
bengal
</label>
Incorrect output shown in browser source for Elements: see above.
Looks like Elements is doing some processing on the PHP?
Bill
(Bill)
19 March 2025 16:01
2
@dan Ah yes, code mutation rears it’s ugly head once again - get the pitch forks out
tpbradley
(Tom Bradley)
20 March 2025 11:25
3
Hey @logrunner ,
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
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.
1 Like
@tpbradley I’ll try the backend; seems like it will resolve my issue.
I’ll await the fix.
@tpbradley , Was this meant to be fixed in 0.67?
I have a line of PHP code that starts like this:
<input type="text" name="search" value="<?php echo isset($_GET['search']) ? htmlspecialchars($_GET['search']) : ''; ?>" ...
and it is getting transcribed to this:
<input type="text" name="search" value="<!--RW::PHP0RW::PHP-->" ...
So it looks like it isn’t fixed yet?
tpbradley
(Tom Bradley)
24 March 2025 09:22
6
Thanks for reporting this, I’ve been able to reproduce it here and looking into it
2 Likes
Hi Tom,
I’ve got the same issue.
My code is…
<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…
<input type="text" name="search" placeholder="Search activities" class="px-3 py-2 border-orange-500 rounded-[3px]" value="<!--RW::PHP2RW::PHP-->">
Thanks,
John
tpbradley
(Tom Bradley)
24 March 2025 11:44
8
Thanks guys, I’ve just added fixed this!
1 Like
That’s great. Do we have to wait for the next release?
tpbradley
(Tom Bradley)
24 March 2025 12:16
10
Yes, a new build should be available soon.
1 Like
Thanks @tpbradley - seems like the issued is fixed in 0.6.9.
1 Like
Hi @tpbradley Seems this issue is not quite resolved in 0.6.9?
My PHP source code:
<!-- 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:
<!-- 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" <!--rw::php5rw::php-->> Bengal </option>
<option value="Burmese" <!--rw::php5rw::php-->> Burmese </option>
<option value="Cornish Rex" <!--rw::php5rw::php-->> Cornish Rex </option>
<option value="Persian" <!--rw::php5rw::php-->> Persian </option>
<option value="Siamese" <!--rw::php5rw::php-->> Siamese </option>
<option value="Tonkinese" <!--rw::php5rw::php-->> 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.
tpbradley
(Tom Bradley)
25 March 2025 12:13
13
Ah yes, I’ve been able to reproduce this here and will try and get a fix in for the next release!
1 Like
tpbradley
(Tom Bradley)
25 March 2025 19:21
14
Good news, there’s a fix in the next release that should be available tomorrow
2 Likes
Hi @tpbradley - Yes, confirmed fixed in V0.7.0 - Thanks.
2 Likes