-
-
Notifications
You must be signed in to change notification settings - Fork 949
Add button for exporting a theme from the demo site #152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
<?php declare (strict_types = 1); | ||
$_POST = json_decode(file_get_contents("php://input"), true); | ||
var_export($_POST['json'],false); | ||
?> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should be no need for fetching any webpages to output the export data.
All it needs to do is create a string in the required format, which can be done with JavaScript code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking about that, but don't we have to format the string to PHP format? Like change the : to =>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, but there's no reason you can't use JavaScript to make the string have =>
in it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So do we want to export just like JSON? "{"property":"#123123"} Is that ok?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider the following code:
const props = {"property":"#123123", "property2":"#123456"}
const output = "[\n" + Object.keys(props).map((key) => `\t"${key}" => "${props[key]}",\n`).join("") + "]";
console.log(output);
You may want to change it up a bit, but basically in a way like this, you can convert JSON into a string that resembles PHP array format.
Description
Hey! I created this working solution, please let me know if it's appropriated. This is not a final solution.
I created json_decode.php file so JS sends the properties json and php exports it to the text area.
It was the only working solution that I could make it work.
HTML and CSS is not final, please let me know where you want me to export it.
Let me know what changes I can make and if I'm going the right path.
Fixes #144
Type of change
How Has This Been Tested?
composer test
Checklist:
Screenshots