2.2-1 Article Module Development

Source: Internet
Author: User

The development directory of the article module is: ~/blog/work/art/1.0.0

Article management has 3 main pages: Article list/add article/Edit article

1. Templates

ATM rules, template files are unified under the version number under the Views folder

So:

1. Create a views folder below ~/blog/work/art/1.0.0

2. Create a List.ejs/add.ejs/edit.ejs three files under the Views folder

2. Entry file

For these three templates, we set three entry files for List.js/add.js/edit.js

These three entry files are a portal file for future collaboration with the research and development, so ATM rules that the portal files that need to be used in the background need to be placed under the exports folder under the version.

So:

1. Create the exports folder below ~/blog/work/art/1.0.0

2. Create list.js/add.js/edit.js three files under the exports folder

3. View the ID of the portal file after it was built

Visit http://127.0.0.1:1234

Click here on the left,

The right side will appear

On the right you can see three files corresponding to the ID of

Work/art:1.0.0/list

Work/art:1.0.0/add

Work/art:1.0.0/edit

Under the template list is a link to three templates

PS (Local node environment interface is temporarily ugly, will continue to optimize later)

4. Invoking the portal file in the template

To add an article (Add.ejs) (Http://127.0.0.1:1234/dev/work/art/1.0.0/views/add), for example, the code is

<% atmjs.use (' Work/art:1.0.0/add '); %><!doctype html>

So the question is, if I have a version upgrade over time, or the art name has changed, or the work name has changed, wouldn't it be that the entry files in each template will have to be changed?

Oh, we have the countermeasure, we have provided three variable placeholder ($family, $module, $version), pay attention to Add.ejs's access address structure/dev/work/art/1.0.0/views/add

Dev is a local build target, and later documents will mention, for the time being

$family'll change to work.

$module will replace art

$version'll replace 1.0.0.

So we can call the portal file like this

<% atmjs.use (' $family/$module: $version/add '); %>

As of now, the project directory is

2.2-1 Article Module Development

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.