Using PHP wite Site Designer - Post...

User 2265269 Photo


Registered User
43 posts

Can someone give me some tips on how to add PHP code to a page using Site Designer.
Tried a small piece of code in a HTML container, with the usual PHP delimiters, but all I got was the code displayed when I previewed the page.
Can't find any help on the forum when I search, so do other programmers use other methods?
I use the PHP to connect to a database at my ISP.
Help would be appreciated.
Rocky48
User 122279 Photo


Senior Advisor
14,447 posts
Online Now

The first thing you need to do is change the file extension in SD from HTML to PHP. You do that in the Page Manager.

I have made some small templates to show how PHP includes can be used, Check the second URL in my signature and choose your framework. Look for a section heading saying PHP. These instructions have been written for people who are not familiar with PHP at all, so if you have used it before, then it should be easy.

Also, in the section Forms there are two forms which use PHP for their back end. You will see, in the simple form, how I have added it to SD, and as to the more complex form there is a version at the bottom of that page which has been made the same way.

BTW, you may know that PHP files cannot be previewed on your computer, unless you have some server software installed. I use XAMPP. Also, PHP files cannot be uploaded to the CC S-drive.
Ha en riktig god dag!
Inger, Norway

My work in progress:
Components for Site Designer and the HTML Editor: https://mock-up.coffeecup.com


User 2265269 Photo


Registered User
43 posts

I my sound a bit thick, but do all the files on the site need to be treated as you have described?
The site that I am updating which I wrote about 10 years ago (www.1066cards4uco.uk) has a page called verses, which is a menu to 3 sets of code.
I am attempting to rewrite the code for the first button on the page which opens another page with 3 sets of combo boxes and a submit button. The combo boxes are populated by databases.
As these actions are in the body of the code, do I need to create an inner container for the main section where I have the forms that connect to the databases?
I have a minor problem with the layout:
There is a gap from where the left-hand edge of the body to the outer container and the right and side disappears under the properties?
If you are willing, I will zip the rsd file with the work I have done so far, but I have not attempted to add the php code yet as I am still unsure as to the correct structure, which will depend on your response.

Rocky48
User 122279 Photo


Senior Advisor
14,447 posts
Online Now

I will certainly do my best with your file if you send it, but here are other people in this forum who are much better with PHP than I am.

If you have read both parts of my PHP includes' How-to, you will have seen that it is not necessary to create the 'inner' containers as I wrote first. It was just meant to be an easy way to catch all the bits you need.

But one thing that I may not have stressed well enough is, that you still have to keep the elements that go into the PHP includes also as page elements. If you remove those parts from the page, you will also lose the CSS for it. This is different from what you may be able to do in the HTML Editor.

I need to see the issues you have before I can say any more. Layout problems should be fairly easy to fix.
Ha en riktig god dag!
Inger, Norway

My work in progress:
Components for Site Designer and the HTML Editor: https://mock-up.coffeecup.com


User 2265269 Photo


Registered User
43 posts

I've been getting in a right muddle! I was going to tidy the files up to send to you, and when I tested the output, I was getting the wrong menu bar and not the one on the screen when I exported it!
After a while I realised because I was using your template which had the black nav bar the header.php in inc was the one that is being displayed.
Question:
    The picture I use as a banner, if I add it to the header.php appears as a small picture in the top LH corner, how do I make it span the page width?
    Do I have to put the header picture in the inc folder, as it is all html code?
    The only code that has php in it is the container below all the header stuff. Should this only be in an inner container?
I tried attaching zip, but too big. an I have your email address?
Rocky48
User 122279 Photo


Senior Advisor
14,447 posts
Online Now

Hi, I have sent you a message through the CC internal messaging system. So please check your email.
Ha en riktig god dag!
Inger, Norway

My work in progress:
Components for Site Designer and the HTML Editor: https://mock-up.coffeecup.com


User 2265269 Photo


Registered User
43 posts

Hi Inger
I sent the files on Wednesday; I don't suppose you have had time to look at it yet?
To understand your first document, I sat and altered it to have pictures I always say that 'pictures replace 1000 words'. I will attach a copy!
But alas after changing my code to conform with your example I still can't get it to display the picture?
I will attach the code for the header and a picture of the resulting page. Instead of the image I get a picture place holder. The pictures are in the img folder, and I wasn't sure if the code after the filename was needed so I removed it.
Attachments:
Rocky48
User 122279 Photo


Senior Advisor
14,447 posts
Online Now

Hi Rocky,

I haven't got your files!! How did you send them?

I have been looking, also in the spam folder, but then I don't know what name to look for. I guess that 'Rocky' might not be your actual name.

It may be that the .rsd file extension was not accepted hy the mailer (I use Gmail), so the best will be to zip it. Or, if you have Dropbox, pop it in there and give me the URL.
Ha en riktig god dag!
Inger, Norway

My work in progress:
Components for Site Designer and the HTML Editor: https://mock-up.coffeecup.com


User 2265269 Photo


Registered User
43 posts

I have just sent the email again, as I did not zip the rsd file.
My name is Hudson hence 'Rocky'. Like you I don't want to broadcast my email. my name is part of the email address and it's with BT.
Rocky48
User 122279 Photo


Senior Advisor
14,447 posts
Online Now

Hi, I'm old enough to remember Rock Hudson :lol:

Got it now! Have a thing or two to do first, but I'll look at it later today.
Ha en riktig god dag!
Inger, Norway

My work in progress:
Components for Site Designer and the HTML Editor: https://mock-up.coffeecup.com



Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.