Unknown code on top of page preview

All WYSIWYG Web Builder support issues that are not covered in the forums below.
Forum rules
IMPORTANT NOTE!!

DO YOU HAVE A QUESTION OR PROBLEM AND WANT QUICK HELP?
THEN PLEASE SHARE A "DEMO" PROJECT.



PLEASE READ THE FORUM RULES BEFORE YOU POST:
http://www.wysiwygwebbuilder.com/forum/viewtopic.php?f=12&t=1901

MUST READ:
http://www.wysiwygwebbuilder.com/getting_started.html
WYSIWYG Web Builder FAQ
Post Reply
Centaur11
 
 
Posts: 8
Joined: Sat Aug 15, 2026 5:35 am

Unknown code on top of page preview

Post by Centaur11 »

I have just bought this software, and am reasonably impressed with it. I have completed my first website, but when I preview it, I get a lot of, what i assume is, error code on top of the preview. I cant make heads or tails out of it.

I used a template provided by WYSIWYG, and removed or changed it quite a bit.


I need help. I have done this website for a friend, and want to get this done so I can send it off.

Below is the error code.

"; throw new Exception($error); } $message .= $eol; $message .= "IP Address : "; $message .= $_SERVER['REMOTE_ADDR']; $message .= $eol; foreach ($_POST as $key => $value) { if (!in_array(strtolower($key), $internalfields)) { if (is_array($value)) { $message .= ucwords(str_replace("_", " ", $key)) . " : " . implode(",", $value) . $eol; } else { $message .= ucwords(str_replace("_", " ", $key)) . " : " . $value . $eol; } } } $body = 'This is a multi-part message in MIME format.'.$eol.$eol; $body .= '--'.$boundary.$eol; $body .= 'Content-Type: text/plain; charset=UTF-8'.$eol; $body .= 'Content-Transfer-Encoding: 8bit'.$eol; $body .= $eol.stripslashes($message).$eol; if (!empty($_FILES)) { foreach ($_FILES as $key => $value) { if ($_FILES[$key]['error'] == 0) { $body .= '--'.$boundary.$eol; $body .= 'Content-Type: '.$_FILES[$key]['type'].'; name='.$_FILES[$key]['name'].$eol; $body .= 'Content-Transfer-Encoding: base64'.$eol; $body .= 'Content-Disposition: attachment; filename='.$_FILES[$key]['name'].$eol; $body .= $eol.chunk_split(base64_encode(file_get_contents($_FILES[$key]['tmp_name']))).$eol; } } } $body .= '--'.$boundary.'--'.$eol; if ($mailto != '') { mail($mailto, $subject, $body, $header); } header('Location: '.$success_url); } catch (Exception $e) { $errorcode = file_get_contents($error_url); $replace = "##error##"; $errorcode = str_replace($replace, $e->getMessage(), $errorcode); echo $errorcode; } exit; } ?>

I think it has to do with the contact form I have done, but I cannot understand where I went wrong, or how to rectify it.

ANY help would be greatly appreciated.
Centaur11
 
 
Posts: 8
Joined: Sat Aug 15, 2026 5:35 am

Re: Unknown code on top of page preview

Post by Centaur11 »

I think I have worked it out. It seems I had used php for the form, but now that I have taken that back to html, all seems good, but now I dont know if my contact form will work correctly. I have tried it in preview form, but it brings up my own email client (of course), but no subject line or form data is in the body of email, and I cant seem to get that info into the email from the form.

Is there a way i can test this contact form to make sure it all works.
User avatar
Pablo
 
Posts: 24839
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: Unknown code on top of page preview

Post by Pablo »

This is the PHP script of the form. If the page uses PHP then you will need to set the page extension to PHP.

See also the FAQ:
https://forum.wysiwygwebbuilder.com/vie ... hp?t=32967
Centaur11
 
 
Posts: 8
Joined: Sat Aug 15, 2026 5:35 am

Re: Unknown code on top of page preview

Post by Centaur11 »

I tried setting the pages to php, but then the menu on the main page did not work. It would not find the index page, but when I changed back to html, all the menu items worked.

Is there a way to use php for the contact form, change extenson for the pages to php, and still have the page menu still work?

Oh, and not get the above code to come back.
User avatar
AliGW
 
 
Posts: 785
Joined: Thu Dec 19, 2024 3:41 pm

Re: Unknown code on top of page preview

Post by AliGW »

Which menus are you using?
Ali
Retired, but still loving to learn & very busy.
https://alisongwright.me.uk
Novice with WWB, but was an avid user of Serif WebPlus before.
Fairly expert at Microsoft Excel (but not VBA) & Affinity by Canva (for page layout).
User avatar
Pablo
 
Posts: 24839
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: Unknown code on top of page preview

Post by Pablo »

If you change the page extension then you will have to republish all pages that are referring to that page, otherwise they still have the old link.
Centaur11
 
 
Posts: 8
Joined: Sat Aug 15, 2026 5:35 am

Re: Unknown code on top of page preview

Post by Centaur11 »

I have changed back to php, and republished the page items in the menue setp, but now when I go to preview, it wont open, just asks what to open with. So i set default programme for .php to Chrome, now it just shows code, and not the web page for preview.

This webpage design and webpage construction is full of pit falls.
Centaur11
 
 
Posts: 8
Joined: Sat Aug 15, 2026 5:35 am

Re: Unknown code on top of page preview

Post by Centaur11 »

AliGW wrote: Sat Aug 15, 2026 6:59 am Which menus are you using?
I am using panel meus.
User avatar
BaconFries
 
 
Posts: 6356
Joined: Thu Aug 16, 2007 7:32 pm

Re: Unknown code on top of page preview

Post by BaconFries »

Is there a way i can test this contact form to make sure it all works.
You cannot "Test" "Preview" php locally it must be uploaded to your host/server for it to work due to the php needs to be processed there.
It will also require that your host supports php if not then then it can't run.
But you can disable PHP in Tools -> Options -> Publish -> Remove PHP code in preview
Centaur11
 
 
Posts: 8
Joined: Sat Aug 15, 2026 5:35 am

Re: Unknown code on top of page preview

Post by Centaur11 »

BaconFries wrote: Sat Aug 15, 2026 8:09 am
Is there a way i can test this contact form to make sure it all works.
You cannot "Test" "Preview" php locally it must be uploaded to your host/server for it to work due to the php needs to be processed there.
It will also require that your host supports php if not then then it can't run.
But you can disable PHP in Tools -> Options -> Publish -> Remove PHP code in preview
Thanks for the heads up.

Looks like I need to watch more "how to" youtube videos.
User avatar
BaconFries
 
 
Posts: 6356
Joined: Thu Aug 16, 2007 7:32 pm

Re: Unknown code on top of page preview

Post by BaconFries »

If you do wish to test locally you can install the likes of xampp on your PC/Laptop this will allow testing. Note that the installation of xampp is outwith the support of the forum and it not related to the softwares use in anyway.
User avatar
Pablo
 
Posts: 24839
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: Unknown code on top of page preview

Post by Pablo »

This webpage design and webpage construction is full of pit falls.
This is not specific to the software; it is related to how forms and PHP work in general.
I have done my best to explain these basic rules in the FAQ. So, if you run into an issue like this, that should be the first place to check.
Centaur11
 
 
Posts: 8
Joined: Sat Aug 15, 2026 5:35 am

Re: Unknown code on top of page preview

Post by Centaur11 »

Pablo wrote: Sat Aug 15, 2026 10:21 am
This webpage design and webpage construction is full of pit falls.
This is not specific to the software; it is related to how forms and PHP work in general.
I have done my best to explain these basic rules in the FAQ. So, if you run into an issue like this, that should be the first place to check.
It was, but after a few hours of the webpage not working because I have .php extension and .php in my contact form, even after doing the "dont run php in preview, I have decided to run it all as HTML. Every time I made a change, none of the menu items worked, except in HTML. As soon as .php is used, either in form or as page type, nothing works. It gets very frustrating.

It is a shame, as I liked what could be done with .php (success or failure pages for the form), but it is too hard to get the form working or to get the menu for the site to keep working. Obviously I am doing something wrong, but, buggered if I can find it or work it out.
User avatar
Pablo
 
Posts: 24839
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: Unknown code on top of page preview

Post by Pablo »

It was, but after a few hours of the webpage not working because I have .php extension and .php in my contact form, even after doing the "dont run php in preview, I have decided to run it all as HTML. Every time I made a change, none of the menu items worked, except in HTML. As soon as .php is used, either in form or as page type, nothing works. It gets very frustrating.
I think it's important to understand why it is not working.

Locally browser can preview HTML, but not PHP. PHP only works via the server.
So, you can preview the layout locally, but to test it will have to publish the website.

All menus work. If there where any know issues then tehy would have already been fixerd.
However, menus only work when point to the correct file. So, links to PHP only work on the server.
HTML links can be viewed locally, because they do not need any processing.

Forms works most reliable when using PHP.

None of the is specific to the software , it just how HTML and PHP works.

Note that there is even a built-in web server with PHP support. So, it is also possible to test this locally, but you will have to install PHP of course.
User avatar
AliGW
 
 
Posts: 785
Joined: Thu Dec 19, 2024 3:41 pm

Re: Unknown code on top of page preview

Post by AliGW »

Centaur11 wrote: Sat Aug 15, 2026 11:09 am It is a shame, as I liked what could be done with .php (success or failure pages for the form), but it is too hard to get the form working or to get the menu for the site to keep working. Obviously I am doing something wrong, but, buggered if I can find it or work it out.
Did you republish the whole site?

1. Save the form page as .php.
2. Republish the whole site so that menus on all pages update to point to the new .php page.

If you haven't yet done this, then you need to.
Ali
Retired, but still loving to learn & very busy.
https://alisongwright.me.uk
Novice with WWB, but was an avid user of Serif WebPlus before.
Fairly expert at Microsoft Excel (but not VBA) & Affinity by Canva (for page layout).
User avatar
BaconFries
 
 
Posts: 6356
Joined: Thu Aug 16, 2007 7:32 pm

Re: Unknown code on top of page preview

Post by BaconFries »

You can set all pages to .php but as mentioned you will need to publish them all to your host/server to see the results. It is important to note forms use php and the page extension needs to be set to .php for it to work.

As mentioned by Pablo the software has its own built in server you can read more about it here.
Local Server Preview it will require php to be installed on your PC/Windows to use the likes of MySqli etc

How to install php locally on your PC
https://www.php.net/downloads.php?os=windows

There is also a video tutorial from Dapsom Ishmael on how to use.
https://youtu.be/9mIyX5nq-k4?is=wydrm52HYGyoLwaM
Centaur11
 
 
Posts: 8
Joined: Sat Aug 15, 2026 5:35 am

Re: Unknown code on top of page preview

Post by Centaur11 »

Thanks to ALL that have replied, and helping a newbie to web design.

I have installed PHP, and voila, all works as I wanted. :D :D :D :D :D :D :D :D

You are ALL legends, and thankyou very much, much appreciated. You have helped me keep what is left of my hair, ha ha ha
Post Reply