diff --git a/.docs/readme/image-1.png b/.docs/readme/image-1.png new file mode 100644 index 0000000..a22b43d Binary files /dev/null and b/.docs/readme/image-1.png differ diff --git a/.docs/readme/image-2.png b/.docs/readme/image-2.png new file mode 100644 index 0000000..9f88443 Binary files /dev/null and b/.docs/readme/image-2.png differ diff --git a/.docs/readme/image-3.png b/.docs/readme/image-3.png new file mode 100644 index 0000000..b82686c Binary files /dev/null and b/.docs/readme/image-3.png differ diff --git a/.docs/readme/image-4.png b/.docs/readme/image-4.png new file mode 100644 index 0000000..a0497e6 Binary files /dev/null and b/.docs/readme/image-4.png differ diff --git a/.docs/readme/image-5.png b/.docs/readme/image-5.png new file mode 100644 index 0000000..3248c63 Binary files /dev/null and b/.docs/readme/image-5.png differ diff --git a/.docs/readme/image-6.png b/.docs/readme/image-6.png new file mode 100644 index 0000000..28b7717 Binary files /dev/null and b/.docs/readme/image-6.png differ diff --git a/.docs/readme/image-7.png b/.docs/readme/image-7.png new file mode 100644 index 0000000..47ae94d Binary files /dev/null and b/.docs/readme/image-7.png differ diff --git a/.docs/readme/image-8.png b/.docs/readme/image-8.png new file mode 100644 index 0000000..84ac3b1 Binary files /dev/null and b/.docs/readme/image-8.png differ diff --git a/.docs/readme/image.png b/.docs/readme/image.png new file mode 100644 index 0000000..8d44ba5 Binary files /dev/null and b/.docs/readme/image.png differ diff --git a/.gitignore b/.gitignore index 9fb5c36..1935c77 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ .env + ###> symfony/framework-bundle ### /.env.local /.env.local.php diff --git a/.google-scripts/config.gs b/.google-scripts/config.gs index a5dac83..79fe34f 100644 --- a/.google-scripts/config.gs +++ b/.google-scripts/config.gs @@ -1,2 +1,2 @@ -var host = 'https://some-site.com'; -secretToken = '9832yc983c0923yv3y#%r9N83983YR93285-3N89C532984CYN&#%rTC379872C'; \ No newline at end of file +var host = 'https://some-site.com/'; +secretToken = 'some_your_strong_authorized_token'; \ No newline at end of file diff --git a/README.md b/README.md index 597d180..01a9b3f 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,10 @@ # CMS Sheets - a site management system based on Symfony and Google Tables ---- + + +--- + + # Installation @@ -11,76 +15,81 @@ git clone git@github.com:artemsites/cms-sheets.git ## Copy and rename ``` -.env.example -> .env +.env.example -> .env ``` ## Set connection MySQL in .env ``` -DATABASE_URL="mysql://username:password@server.com:3306/dbname" +DATABASE_URL="mysql://username:password@server.com:3306/dbname" ``` With mysql version: ``` -DATABASE_URL="mysql://username:password@server.com:3306/dbname?serverVersion=5.7.21" +DATABASE_URL="mysql://username:password@server.com:3306/dbname?serverVersion=5.7.21" ``` -## Upload code to your server -One level higher than your public folder for the site! +## Copy Google Table (Sheet) to your drive +https://docs.google.com/spreadsheets/d/19NC3QrrWEvAwljyhzKF9LqCds4gtOvP5OAZUqqd3k-w/edit?usp=sharing -## Create link to public -If the root folder on your server is set to public_html: +## Migration tables to your database ``` -ln -s public public_html +php bin/console doctrine:migrations:migrate ``` +It is migrate file migrations/Version[id].php to your database! -## Update vendor libs -``` -composer update +## Change Key and Domain in Google Table +![alt text](.docs/readme/image.png) +![alt text](.docs/readme/image-1.png) +> Внимание! Если у вас на сайте ещё нет https то необходимо в ссылке заменить https на http! + +## And set this key to .env file +![alt text](.docs/readme/image-2.png) + +## Compress code to ZIP and upload to server (for example to shared hosting) +![alt text](.docs/readme/image-3.png) +![alt text](.docs/readme/image-4.png) +![alt text](.docs/readme/image-5.png) + +## Setting HTTPS and redirect to it and setting last PHP version at you site in hosting panel or you server! -# if shared hosting & composer installed to ~/.local/bin/composer +## Update composer vendors (libs) +For example at shared hosting (beget.com): +``` php8.3 $(which ~/.local/bin/composer) update ``` +![alt text](.docs/readme/image-6.png) +## Then create first page at google table! +![alt text](.docs/readme/image-7.png) +## And upload this content to site! +1. Select the line (web page data) that you want to send to the site. +2-3. Send the changes to the website! +![alt text](.docs/readme/image-8.png) -## Create migration Entities (src/Entity) to your db (with mysql connect) -``` -php bin/console make:migration -php bin/console doctrine:migrations:migrate +After that, the cache of this page will be reset and the updated content will be displayed on the site! + +In this case, the content can be written directly to the content column, so you can place a link to html or md markup there so as not to clutter the table cell! -# if shared hosting -php8.3 bin/console make:migration -php8.3 bin/console doctrine:migrations:migrate -``` +--- -## Create site files in Google Drive: -1 Create site folder for site files in Google Drive - somesite.com -2 Download file "Pages & Menu" - https://docs.google.com/spreadsheets/d/19NC3QrrWEvAwljyhzKF9LqCds4gtOvP5OAZUqqd3k-w -3 Create in Google Drive: - somesite.com/Pages & Menu -4 Add key to: - 1 Расширения -> Apps Script -> config.gs (and domain) - 2 .env -> APP_GOOGLE_APP_SCRIPTS_TOKEN +# Features ---- +## Fill in the content as HTML or MD +## Insert shortcodes like [[youtube id="7c238trc"]] into the content (HTML or MD) -# Features +--- -## Fill in the content as HTML or MD -## Insert shortcodes like [[youtube id="7c238trc"]] into the content (HTML or MD) ---- # Configuration -## Vue the type of interpolation brackets is specified in .env: +## Vue the type of interpolation brackets is specified in .env: SHORTCODE_START_REGEXP SHORTCODE_END_REGEXP > It shouldn't be {{ }} - it's twig @@ -88,7 +97,11 @@ php8.3 bin/console doctrine:migrations:migrate > Probably better [[ ]] > ! It is important to specify in REGEXP format, that is, special characters should be escaped \[\[ - otherwise they will be incorrectly read in REGEXP and will not be used ---- + + +--- + + # Shortcodes diff --git a/migrations/Version20240601155844.php b/migrations/Version20240601155844.php new file mode 100644 index 0000000..83aad90 --- /dev/null +++ b/migrations/Version20240601155844.php @@ -0,0 +1,35 @@ +addSql('CREATE TABLE menu (id INT AUTO_INCREMENT NOT NULL, id_cms BIGINT NOT NULL, url VARCHAR(255) NOT NULL, name VARCHAR(255) NOT NULL, type SMALLINT DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); + $this->addSql('CREATE TABLE page (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, title LONGTEXT NOT NULL, description LONGTEXT NOT NULL, content LONGTEXT NOT NULL, id_cms BIGINT NOT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, url VARCHAR(255) NOT NULL, template VARCHAR(255) DEFAULT NULL, off VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); + $this->addSql('CREATE TABLE messenger_messages (id BIGINT AUTO_INCREMENT NOT NULL, body LONGTEXT NOT NULL, headers LONGTEXT NOT NULL, queue_name VARCHAR(190) NOT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', available_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', delivered_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', INDEX IDX_75EA56E0FB7336F0 (queue_name), INDEX IDX_75EA56E0E3BD61CE (available_at), INDEX IDX_75EA56E016BA31DB (delivered_at), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql('DROP TABLE menu'); + $this->addSql('DROP TABLE page'); + $this->addSql('DROP TABLE messenger_messages'); + } +}