mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
tutorials: article json
This commit is contained in:
parent
48ea136a9a
commit
5971aa7fef
@ -342,7 +342,7 @@ pub fn (app mut App) new_article() {
|
|||||||
title := app.vweb.form['title']
|
title := app.vweb.form['title']
|
||||||
text := app.vweb.form['text']
|
text := app.vweb.form['text']
|
||||||
if title == '' || text == '' {
|
if title == '' || text == '' {
|
||||||
app.vweb.text('Empty text/titile')
|
app.vweb.text('Empty text/title')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
article := Article{
|
article := Article{
|
||||||
@ -359,7 +359,10 @@ pub fn (app mut App) new_article() {
|
|||||||
parameters via function arguments: `new_article(title, text string) {`.
|
parameters via function arguments: `new_article(title, text string) {`.
|
||||||
|
|
||||||
We need to update `index.html` to add a link to the "new article" page:
|
We need to update `index.html` to add a link to the "new article" page:
|
||||||
|
|
||||||
|
```html
|
||||||
<a href='/new'>New article</a>
|
<a href='/new'>New article</a>
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
BIN
tutorials/img/articles_json.png
Normal file
BIN
tutorials/img/articles_json.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 194 KiB |
Loading…
Reference in New Issue
Block a user