Skip to content
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

An idea: Is it possible to labelize all the fields? #651

Open
huazailong opened this issue Dec 8, 2023 · 2 comments
Open

An idea: Is it possible to labelize all the fields? #651

huazailong opened this issue Dec 8, 2023 · 2 comments

Comments

@huazailong
Copy link

Using custom tags can separate the front-end display from the back-end logic, allowing front-end developers to focus more on page presentation and structure, while enabling back-end developers to concentrate on data processing and logic.
The backend will labelize all the fields we need to call, using tags similar to {} or [] to wrap the dynamically generated content.

TDK:

<title>{tdk name="title"/}</title>
<meta name="description" content="{tdk name="description"/}" />
<meta name="keywords" content="{tdk name="keywords"/}" />

Article List:

<div>
{list_article type="list"  row="10" order="id desc" infolen="10"}
<a href="[value:url/]" title="[value:title/]">[value:stitle/]</a>
{/list_article }
</div>

Currently, the theme uses a mix of php, html, css, and js, which looks messy. If we customize all the tags, the theme files will end with html, eliminating the need for php files. Now, only html, css, js, and tag calls are required.

This approach will make it easier for front-end or back-end developers to develop and maintain.

@danpros
Copy link
Owner

danpros commented Dec 8, 2023

Hello,

Yes its possible. We need to use eg. Twig for faster developments. As an example, currently in htmly.php there is:

        render('add-page', array(
            'title' => i18n('Add_new_page') . ' - ' . blog_title(),
            'description' => strip_tags(blog_description()),
            'canonical' => site_url(),
            'type' => 'is_page',
            'is_admin' => true,
            'bodyclass' => 'add-page',
            'breadcrumb' => '<a href="' . site_url() . '">' . config('breadcrumb.home') . '</a> &#187; ' . i18n('Add_new_page')
        ));

If using Twig seems just replace it using like:

$twig->render('add-page.twig', array(...));

Template file changed from add-page.html.php to add-page.twig.

@bttrx
Copy link
Contributor

bttrx commented Dec 23, 2023

But using Twig would add another 368 files (Twig-2.16.0) or 180 files (Twig-3.8.0) to the HTMLy footprint!

Maybe something similar can be achieved in only 66 files (plates-3.5.0)? (I never used it.) https://github.com/thephpleague/plates

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants