htmly icon indicating copy to clipboard operation
htmly copied to clipboard

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

Open huazailong opened this issue 2 years ago • 2 comments

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.

huazailong avatar Dec 08 '23 05:12 huazailong

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.

danpros avatar Dec 08 '23 06:12 danpros

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

bttrx avatar Dec 23 '23 17:12 bttrx