Jump to content

swag: PHP-Server


Recommended Posts

Hey guys!

I'm currently learning to setup and develop some basic websites with the basics i've learned at University.

 

I already have swag up and running on my Unraid Server.

I was able to get a website running with some basic HTML and JS and access it over DNS, but now i want to use some PHP.

I have no clue, how to use PHP with swag and found absolutely nothing about it on the internet.

I've tried to just implement some PHP code in the standard index.html in the www/ folder, but it doesn't do anything at all.

 

 

I would appreciate any help.
Thanks in advance!

 

JM

Link to comment
  • 2 months later...
On 11/23/2020 at 12:55 PM, JealousMaiden said:

I've tried to just implement some PHP code in the standard index.html in the www/ folder, but it doesn't do anything at all.

 

PHP incorporated into an HTML file always runs prior to the page being loaded.

 

ie: 

...
<?PHP
  var $test = "This is a test";
?>
<script>
  $("#element").html("<?=$test?>");
</script>

Will result in the javascript sent to the browser being

  $("#element").html("This is a test");

Are you trying to make the PHP dynamically affect the page?  In this case, you need to use appropriate post / get / ajax calls

  • Like 1
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...