Hello everybody
With version v1.4.7 I implemented some sort of application logic to trigger mails to customers etc. Now I tried to achieve this with version v2.0 using config_list_view and config_form_view and not needing to use snippets. As an advantage all application logic lies inside the template files. As an example see here an example mailer app. One can send mails to a list (clonable template) of recipients. It consists of the basic concepts I used in my larger application in v1.4.7.
While implementing I struggled with the functionality with these new concepts, namely:
- Application logic within config_form_view must be within a field tag. Outside nothing is executed.
- I had to use placeholder fields to implement application logic and output formatted html, e.g. bootstrap rows and cols.
- I had to hide (skip='1') all fields outputted manually in order that they do not appear twice
- The tag do_shortcodes worked only when placing it within the send_mail tag. Outside, e.g. within the pages tag, it did not work.
- Fields outputted used to hold the chosen action and the selected items of the list had to be stored (persist tag at the beginning of config_form_view) from the temporary fields (with added frm_). An at the end I had to empty these fields again (db_persist).
- Since no code is executed outside field tags and within persist tag it is not possible to make some minimal app logic as follows:
- Code: Select all
<cms:set name="<cms:random_name />" scope='global' />
<cms:persist
k_page_name="<cms:if k_page_name==''><cms:show name /><cms:else/><cms:show k_page_name /></cms:if>"
k_page_title="<cms:if k_page_name==''><cms:show name /><cms:else/><cms:show k_page_title /></cms:if>"
_auto_title='1'
/>
Instead I had to do it the following restricted way:
- Code: Select all
<cms:persist
k_page_name="<cms:if k_page_name==''><cms:random_name /><cms:else/><cms:show k_page_name /></cms:if>"
k_page_title=k_page_name
_auto_title='1'
/>
But it actually works. Does anyone has Ideas to make the code more slick and clean? Or to find a better solution to the mentioned constraints?
The attached file uses a minimal bootstrap grid. It is added within the template "bootstrap". So change setting number 26 on config.php. Also add the snippeds for shortcodes in the kfunctions.php.
I would be glad to have the best possible solution before rewriting the code for v2.0 of my extended application.