PHP script is added where?

Greetings,
Just purchased Foundry and am trying to come up to speed on all of its features.

That said, where do I enter my PHP webpage scripts?

Thanks,
Phillip

Phillip, you can place your PHP code within PHP tags in the default HTML stack that comes with Stacks. Donā€™t forget to change your page extension from HTML to PHP so that it will execute.

1 Like

Thanks for the feedback.

I have read that PHP scripts had to be placed in the Prefix pane of Page Inspector and not the HTML pane, so was not certain where to place the PHP scripts.

Very glad to know that I should use the Stacks / HTML stack and not the RW Page Inspector.

Thank you very much for that invaluable information.

I should have asked the obvious:

Where exactly do I add the Stacks / HTML stack on the webpage?

I would assume at the bottom, but could be wrong.

Thanks!

There isnā€™t one correct answer to this. It really depends on what the script does and what else is on the page. If itā€™s PHP code that needs to execute before anything else on the page, then youā€™ll want it in the Prefix pane. If you want the code to execute and display a result after your banner, then youā€™ll want to place it in an HTML stack in the page where the result will be displayed.

Thanks for your guidance.

Initially, all pages will require a PHP footer script. As soon as I get this new RW8 site off the ground I will be adding a mySQL/mariaDB database which will require much more PHP scripting.

From what you have said, correct placement is the key. Got it.

Once I add a few scripts using both the PI Prefix and and the Stacks / HTML stack I will feel more comfortable.

I appreciate your help.

I have another question for you:

I have successfully
(1) Added the html Stacks / stack to my Foundry project
(2) Added my PHP footer script and it appears at the bottom of the page.

I did this by adding an includes folder with my public_html folder and placing the script within this includes folder.

My question is this: I want to style my footer so do I add a CSS folder to my server and place my styles.css file within this folder?

I use FTP app is Transmit and am extremely comfortable manually adding/changing files with this app. I would prefer doing my styling in this manner, but if there is a ā€˜preferredā€™ method to add styling then Iā€™m all ears.

Thanks for any help you can provide,
Phillip

I think Iā€™m now good.

I added my CSS to the Stacks/ html stack and that only exposded the css in the footer. Ha!

I then removed this CSS styling and placed it in the PIā€™s CSS pane and it all worked.

Iā€™m learning!

Thanks,
Phillip

There are a number of places you can add the CSS you need for formatting.

First, you could put it in an HTML stack on the page, but you would need to put the CSS within <style></style> tags for it do be treated as CSS and not page content.

Next, you could put in the Page Inspectorā€™s CSS area. I believe this is what you did.

Finally, you could also put it in the ā€œCode - CSSā€ are in the left sidebar (under ā€œAdvancedā€). Placing it there will apply that CSS to all pages. Since you are formatting a footer, itā€™s probably better here than in every pageā€™s CSS area. In the future, you only have one place to make any changes.

1 Like

THANK YOU ad infinitum!!! ā€¦ is all I can think to say to you.

Your guidance is pure gold to me.

Briefly ā€¦
I abandoned RW back in 2018 or thereabouts because of all the issues I was having trying to get all the ā€˜partsā€™ to play nicely together. That forced me to teach myself html, CSS and PHP. I do not claim to be master of any of these, but it did give me the ability to finally build a website without spending half of my time trying to fix things. I was never satisfied with any RW/theme project and, in truth, most of that unsatisfaction was due to the fact I never felt in full control of any aspect of those RW projects.

Fast forwarding ā€¦
I have no logical explanation as to why I decided to give RW another go, but I did. I was commisoned to built a new site for a water association and decided to take a look and see how things had changed. Or not changed. So I began a thread asking where all the themes had gone. Someone explained that frameworks were why themes were no longer necessary. From there I chose Foundry and here I am.

So, all that said, it is individuals such as yourself, who give invaluable advice that has made my return to Rapid Weaver Land so pleasant.

Oh, I had some drama initially because my version of RW8 refused to load Stacks 4, which was valid (paid for) and up to date. That episode brought back all the bad memories and I thought, ā€œHere we go again!ā€ and was ready to toss in the towel again. Needless to say, I am very glad I stuck it out. Actually, I found some of Isaiahā€™s astute advice on how to resolve that dilemma and after that it has been smooth sailing.

Sorry for the tome, but now you know.

Thanks again,
Phillip

P.S. Here is the one-page unfinished site built with Foundry. I am currently in a holding pattern waiting for board memberā€™s to provide images/text to complete the index page. I will also be feeding this site sensor data from their water tanks. There is much to be done.