{"id":22695685,"url":"https://github.com/tina4stack/tina4-cms","last_synced_at":"2026-01-26T12:13:02.031Z","repository":{"id":40709125,"uuid":"313451469","full_name":"tina4stack/tina4-cms","owner":"tina4stack","description":"CMS module for Tina4","archived":false,"fork":false,"pushed_at":"2024-04-25T07:38:18.000Z","size":28464,"stargazers_count":5,"open_issues_count":6,"forks_count":17,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-25T08:39:15.324Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tina4stack.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-11-16T23:17:02.000Z","updated_at":"2024-04-25T07:38:21.000Z","dependencies_parsed_at":"2024-02-19T23:31:43.165Z","dependency_job_id":"3c26e26f-0792-4108-9595-2a58dba82533","html_url":"https://github.com/tina4stack/tina4-cms","commit_stats":{"total_commits":153,"total_committers":3,"mean_commits":51.0,"dds":0.02614379084967322,"last_synced_commit":"894f0b990f78e2a753076ba7a4801db7257a43d4"},"previous_names":[],"tags_count":50,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tina4stack%2Ftina4-cms","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tina4stack%2Ftina4-cms/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tina4stack%2Ftina4-cms/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tina4stack%2Ftina4-cms/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tina4stack","download_url":"https://codeload.github.com/tina4stack/tina4-cms/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248658379,"owners_count":21140933,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-10T04:11:34.654Z","updated_at":"2026-01-26T12:12:56.989Z","avatar_url":"https://github.com/tina4stack.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Tina4 CMS Module\n\nWelcome to the Tina4CMS module, how does it work?\n\n```\ncomposer require tina4stack/tina4cms\n\ncomposer exec tina4 initialize:run\n```\n\nSqlite is recommended for small to medium websites\n\n```bash\ncomposer require tina4stack/tina4php-sqlite3\n```\n\nAdd the database connection to your index.php file which would have been created\n\n```\nrequire_once \"vendor/autoload.php\";\n\nglobal $DBA;\n\n$DBA = new \\Tina4\\DataSQLite3(\"test.db\",\"\", \"\", \"d/m/Y\");\n\necho new \\Tina4\\Tina4Php();\n```\n\nRun the CMS\n```commandline\ncomposer start 8080\n```\n\nOpen up the CMS to set up the admin user\n\nhttp://localhost:8080/cms/login -\u003e will get you started\n\n### The Landing Page - home\n\nYou need to create a landing page called \"home\" as your starting page for things to working properly.\n\n### Customization\n\nMake a  *base.twig* file in your */src/templates* folder, it needs the following blocks\n```\n\u003c!DOCTYPE html\u003e\n\u003chtml lang=\"en\"\u003e\n\u003chead\u003e\n    \u003ctitle\u003e{{ title }}\u003c/title\u003e\n    \u003cmeta prefix=\"og: https://ogp.me/ns#\" property=\"og:title\" content=\"{{ title }}\"/\u003e\n    \u003cmeta prefix=\"og: https://ogp.me/ns#\" property=\"og:type\" content=\"website\"/\u003e\n    \u003cmeta prefix=\"og: https://ogp.me/ns#\" property=\"og:url\" content=\"{{ url }}\"/\u003e\n    \u003cmeta prefix=\"og: https://ogp.me/ns#\" property=\"og:image\" content=\"{{ image }}\"/\u003e\n    \u003cmeta prefix=\"og: https://ogp.me/ns#\" property=\"og:description\" content=\"{{ description }}\"/\u003e\n{% block headers %}\n    \u003clink rel=\"stylesheet\" type=\"text/css\" href=\"/src/public/css/default.css\"\u003e\n{% endblock %}\n\u003c/head\u003e\n{% block body %}\n\u003cbody\u003e\n{% block navigation %}\n    {% include \"navigation.twig\" %}\n{% endblock %}\n\n{% block content %}\n{% endblock %}\n\n{% block footer %}\n{% endblock %}\n\u003c/body\u003e\n{% endblock %}\n\u003c/html\u003e\n```\nor an example which extends the existing base in the tina4-cms\n```\n{% extends \"@tina4cms/base.twig\" %}\n\n{% block headers %}\n    \u003clink rel=\"stylesheet\" type=\"text/css\" href=\"/src/templates/css/default.css\"\u003e\n{% endblock %}\n\n{% block body %}\n\u003cbody\u003e\n    \u003cdiv class=\"content\"\u003e\n{% block navigation %}\n    {%  include \"navigation.twig\" %}\n{% endblock %}\n\n{% block content %}\n{% endblock %}\n    \u003c/div\u003e\n\u003c/body\u003e\n{% endblock %}\n```\n\n\n#### Example of a navigation.twig which you can over write\nCreate a *navigation.twig* file in your *src/templates* folder\n```\n{% set menus = Content.getMenu(\"\") %}\n\u003cnav\u003e\n    \u003cul\u003e\n        {% for menu in menus %}\n            \u003cli\u003e\u003ca href=\"{{ menu.url }}\"\u003e{{ menu.name }}\u003c/a\u003e\n                {% if menu.children %}\n                    \u003cul\u003e\n                        {% for childmenu in menu.children %}\n                            \u003cli\u003e\n                                \u003ca href=\"{{ childmenu.url }}\"\u003e{{ childmenu.name }}\u003c/a\u003e\n                            \u003c/li\u003e\n                        {% endfor %}\n                    \u003c/ul\u003e\n                {% endif %}\n            \u003c/li\u003e\n        {% endfor %}\n    \u003c/ul\u003e\n\u003c/nav\u003e\n```\n\n### Including your snippets in the CMS\n \nThere are two ways you can do this:\n\nWhen you want to include content as it is, and not have the snippet parsed with Twig you can simply use the following:\nUse the raw filter when you want to have scripts or other things included correctly\n```\n{{snippetName | raw}} or {{snippetName}}\n```\n\nThe following is how you would include a snippet where you want variables in the page for example parsed in the snippet\n```\n{{ include(getSnippet(\"snippetName\")) }}\n```\n\n#### Example:\n\nPage content of \"home\"\n```\n  {% set world = \"World!\" %}\n  \n  {{ include (getSnippet(\"mySnippet\")) }}\n```\n\nSnippet content of \"mySnippet\"\n```\n  Hello {{world}}!\n  \n```\n\nAdding articles into a page\n```\n{% set articles = Content.getArticles (\"\", 8) %}\n{% for article in articles %}{% include \"snippets/medium.twig\" with {\"article\": article} %}{% endfor %}\n{% set params = {\"tag\": \"all\", \"skip\": 4, \"limit\": 4, \"template\": \"medium.twig\"} %}\n{% include \"load-more.twig\" with params %}\n```\n\nOverwriting the default CMS twig namespace - your own namespace\n```\nCMS_TWIG_NAMESPACE=\"\"\n```\n\n## Page Builder\n\nThe page builder should implement GrapeJS and allow you to build pages using blocks and components. The blocks and components should be simple to load.\nWe need to flag off pages that have been edited by the Page builder so the generic CMS does not try to render them.\n\n## Themes\n\nUse with care, this is currently experimental but will be introduced into the CMS at some point as a base for the pages\nCurrent thoughts are as follows:\n\n### Theme Structure\n\n```\nsrc\n    templates\n        themes\n            theme-name\n                blocks\n                    block-name-1.json\n                    block-name-2.json\n                components\n                    component-name-1.json\n                    component-name-2.json\n                theme.twig\n``` \n\nThe default theme can be cloned to make other themes.\n\n### Examples of extending the CMS Page Builder\n\nIn your index.php file where your config is initialized you can define the following.\n\n```php\n$config = new \\Tina4\\Config(function(\\Tina4\\Config $config) {\n    (new Content())-\u003eaddCmsMenu(\"/backend/program\", \"Products\"); //Menu example\n    $config-\u003eaddTwigGlobal(\"Menu\", new Menu()); //Adding a twig global class\n    (new Theme())-\u003eaddTwigView(\"product\", \"Products\", \"examples/products.twig\"); //Adding different snippets for use in CMS views\n    (new Theme())-\u003eaddTwigView(\"menu\", \"Menu\", \"examples/menu.twig\");\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftina4stack%2Ftina4-cms","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftina4stack%2Ftina4-cms","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftina4stack%2Ftina4-cms/lists"}