How to add new element using View(template)

i am trying to add a new element using CBI as well as View (Template) using the openwrt Doc link is here :- https://openwrt.org/docs/guide-developer/luci
i have created a new element using CBI method but when i am trying to do the same thing using View(template ) i am getting is error:-

Failed to execute template dispatcher target for entry '/admin/status/view'.
The called action terminated with an exception:
/usr/lib/lua/luci/template.lua:74: Failed to load template 'admin_status/view'.
Error while parsing template '/usr/lib/lua/luci/view/admin_status/view.htm':
Syntax error in /usr/lib/lua/luci/view/admin_status/view.htm:63:unfinished string near '"'
stack traceback:
    [C]: in function 'error'
    /usr/lib/lua/luci/template.lua:74: in function '__init__'
    /usr/lib/lua/luci/util.lua:65: in function 'Template'
    /usr/lib/lua/luci/template.lua:27: in function 'render'
    /usr/lib/lua/luci/dispatcher.lua:824: in function </usr/lib/lua/luci/dispatcher.lua:823>

Can anyone tell me where have i gone wrong ?

view.htm line 63

wulfy i have copied the same thing from the openwrt site
this my code :-

(  <%+header%>
   <h1><%:Hello World%></h1>                                                      
   <%+footer%>
)

can you please tell me what line 63 have to look for ?

please

  1. click edit ( pencil )
  2. copy the code
  3. click the </> symbol + paste between the ''' ( and add two more lines of "surrounding code" )

which one is line 63? ( you've edited the file... your the only one who has access to that information )

1 Like

wulfy i have used the same code from the openwrt website this one :-
https://openwrt.org/docs/guide-developer/luci

<%+header%>                                                                    
<h1><%:Hello World%></h1>                                                      
<%+footer%>

and the error is generated when i click on the view table on the webpage ?
there is not line 63 in my view(template) code .

Please post the output of cat /usr/lib/lua/luci/view/admin_status/view.htm

cat /usr/lib/lua/luci/view/myapp-mymodule/view_tab.htm

<%+header%>
<h1><%:Hello World%></h1>
<%+footer%>

view_tab.htm != view.htm
/usr/lib/lua/luci/view/myapp-mymodule != /usr/lib/lua/luci/view/admin_status

i have referred this link to make my view tab:-https://openwrt.org/docs/guide-developer/luci
and jow what do i do with you method ( view_tab.htm != view.htm
/usr/lib/lua/luci/view/myapp-mymodule != /usr/lib/lua/luci/view/admin_status)
because i didn't understand it ?

I want you to please provide the output of cat /usr/lib/lua/luci/view/admin_status/view.htm because this is the broken file. The contents of view_tab.htm are not relevant at this point.

ok here is the ouput
cat /usr/lib/lua/luci/view/myapp-mymodule/view_tab.htm
output

i have add comment in this code

Not cat /usr/lib/lua/luci/view/myapp-mymodule/view_tab.htm, but cat /usr/lib/lua/luci/view/admin_status/view.htm.

The broken file is in a different path.