Modify Luci Include new tab to show text in the file

I have a file auto generating named tmp/yes which have text inside. I also have created a new tab in a template form with the file name yyy.htm.
But i cant show the text file on the web page, I am currently using the following code, but its not working for me,

      <embed src = "tmp/yes" width = "100%" height = "60" >

this is the yyy.htm file. And also i have tried storing the file yes at different places but its not working.
please help

is intended for plugins, so having it to include a text file might not work on some browser. I tested it on a Windows 10 PC; it worked on Chrome, Fire Fox, Opera, but not on Edge or IE.

seems to work on IE after Active X warning but didn't work on Edge, like the following

    bla bla bla
    <embed src = "tmp/emb" width = "100%" height = "60" >
    <object width="1000" height="200" data="tmp/emb2"></object>

So, generally speaking, to include some text file in an HTML you should probably use JavaScript or some scripting language.

1 Like

Thanks for the reply
I am not getting it even in the firefox, where did you store the file yes?
Or is there something wrong my lua file?

module("luci.controller.admin.yes", package.seeall)

function index()
        entry({"admin", "yes"}, firstchild(), "YES", 60).depedent=false
        entry({"admin", "yes", "tab_one"}, template("yyy"),_("kamnu"), 1)

same folder or a sub folder, both work, also with a file extension and without.

I don't know, to be honest. I never looked at the source code before (shame on me) :unamused:. All I have is the binary on my router. I was only talking about HTML in general.

I recommend you try it with a simple HTML file like mine, and see if it works on your browser before you try to use it with LuCI.

oh i have tried it generally, but there is something more with the openwrt I believe thats why I am not getting any results.

I don't know where are you putting the code. Is it in the part you shared? (Sorry, I have no clue how lua file is supposed to look. I am confused what's "tmp/yes" and what's yyy.htm", and if the "yes" in the function index has anything to do with them.

If you share what you have I could try to figure out what's wrong.

so the lua file which have that module and function goes at usr/lib/lua/luci/controller/admin/yes.lua and yeah it is the code that i asked you as a reply.
and in that file luci.controller.admin.yes is the location so, luci/controller/admin/yes.lua

in function admin.yes means admin/yes URL.
the template("yyy") is the name of the .htm file which will be shown at admin/yes/tab_one URL and it is being stored at ..../luci/view/yyy.htm and i have put the code of yyy.htm in the question.
and the name of the tab will be YES and the 1st subtab will be kamnu

and the tmp/yes is yes file without any extension which I am trying to show at the subtab named kamnu or say at the URL

It's really difficult to debug a code without seeing it. Where is the implementation of entry()?

Is there a reason your previous thread (still open) wasn't a good location for this?