drogonframework / drogonframework/drogon

Ability to add parameters to subviews

Open
#1,794 0 comments 3 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
14.3k
Forks
1.4k
Avg merge
1d 13h
Merged PRs (30d)
14

Description

It isn't clear in the wiki, but the `<%view` and `<%layout` tags have limitations. The subview is only a macro that inserts content and layout has only one parameter and the view can use only one layout.

**Is your feature request related to a problem? Please describe.**
I have the skeleton of a page and I want to reuse it. It has multiple placeholders that should be filled with content of specific pages. The placeholders aren't contiguous and Drogon supports only one placeholder.

**Describe the solution you'd like**
The view file would have a subview in it with parameters (like JSP). A new syntax or keywords would have to be created. This is an example of syntax.
```
<%subview filename1.csp %>
<%param param1>
... HTML code
<%param-end %>
<%param param2>
... HTML code
<%param-end %>
<%subview-end %>
```

The subview would have places where the parameters would be inserted.
```
<%pram-insert param1 %>
...
<%pram-insert param2 %>
```

**Describe alternatives you've considered**
The workaround is to make kludge using Javascript to move the HTML blocks to the placeholders.

**Additional context**
This feature is like JSP custom tags.

This feature would also make the current `<%view` and `<%layout` tags obsolete.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.