Site builder Html segment replacing -> with &gt. Help!

mixednut

New Member
Messages
4
Reaction score
0
Points
1
Hi everyone,

So I am using the provided web-builder and I am trying to add an HTML segment or block. I add the HTML block on to the page, and then I attempt at writing a php script in the html section. When I publish or preview the website it says:
Parse error: syntax error, unexpected '&'

and when I check where this error happens... it happens every time when i have a '->' in my code... for example:
I have the line
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);


which gets turned into:
if ($conn&gtconnect_error) {
die("Connection failed: " . $conn&gtconnect_error);

I have tested my code (and it works) by putting it directly in the file (using file manager) but the problem is that anytime I want to make a small aesthetic adjustment using the builder it will overwrite my code that I added using the manager...

Does anyone know of a solution?
 

essellar

Community Advocate
Community Support
Messages
3,295
Reaction score
227
Points
63
Oddly enough, the Site Builder front end (client) is not designed to add PHP code to the site. Note that you're adding an HTML segment, not a PHP segment. It would say "PHP segment" if it allowed PHP.
 

mixednut

New Member
Messages
4
Reaction score
0
Points
1
But if I'm not mistaken the section gets placed in a php file for that page anyways so it should still run. At least it did when I looked at the files after I added it
 

mixednut

New Member
Messages
4
Reaction score
0
Points
1
Let me clarify that... When I build a site using the front end builder, publish it, then go to the file manager. The files for my website are: 1.php 2.php 3.php etc...

Now I directly edited 4.php to add the code to connect to a database and saved it. I ran the website and it worked fine.

I then went to the front end and changed something but after saving noticed that this overwrites the code I manually added. So I tried to use the HTML segment. I copied the exact same php code that I had entered manually and pasted it inside the HTML segment.

I saved it and then published it and got the error I mentioned at the beginning. But when I went to my file the code is in the exact same file (4.php) and is the exact same as if I had done it manually but it changes those > with &gt.

I get why it's doing it, because the thing thinks it's > greater than but you can see how this would prevent me from editing the aesthetics of the page with the front end and try to connect to a database.

Does anyone else use the front end and found out a way to connect to a database? That's all I really need to know. Rather than re adding the code every time I want to change something.
 
Top