Forum OpenACS Q&A: How could I run tclet in a page

Collapse
Posted by David Ghost on
I manage to run classic tclet programs on Tcl Plugin Home Page.
But with my aolserver I can't.
my test page is so simple, it reads like below

<html>
Hello
<embed src="/test.tcl" width="120" height="100">
</html>

What's wrong with me...

Collapse
Posted by Richard Hamilton on
Check the syntax for adding tcl inline to .adp pages.

I have never needed to do this so cannot answer precisely (openacs does not encourage running tcl embedded in adp pages) but maybe you could start by adding the contents of your test.tcl inline - I think it is like this :

<% tcl code here %>

Once that works you could look up in the Aolserver docs check any other options.

The ACS way is to run the .tcl file and have that generate the html.

R.

Collapse
Posted by David Ghost on
Thanks Richard,
Here is my test.tcl code

button .b -text "Hello"
pack .b

As far as I know, with inline tcl syntax
I cannot run above .tcl file.

Anyway thanks a lot Richard

Collapse
Posted by Alfred Werner on
What if you try the following:

save the tclet source in a file with a distinct extension - say tcx

add the tcx file extension with mime-type of application/x-tclet in the config.tcl file.

The browser should only care about the mime header, not your local file extension.

Collapse
Posted by Alfred Werner on
sorry - I think it is application/x-tcl
Collapse
Posted by David Ghost on
Yes, Alfred I had tried as you told, but it failed.
With the very same IE browser & tcl plugin, I am able to run demo scripts provided at www.scriptics.com/software/plugins.
Only with my aolserver where my test version of dotLRN resides makes troubles.
Still I'm waiting the right answer

Thanks a lot Alfred

Collapse
Posted by Don Baccus on
Are those procs returning HTML?  If so you can say ...

<%=proc_name arg1 arg2 ... argn%>

and the output of the proc will be inserted into the HTML returned to the browser client.

Collapse
Posted by David Ghost on
Here is my trouble summary

I created a html(or adp) file named test.html which read
<html>
Hello
<embed src="/test.xtl" width="120" height="100">
</html>

And test.xtl file looks like below containing tk code:
button .b -text "Hello"
pack .b

Of course I installed TCL Plugin into my IE browser
which tested successfully with tcltk plugin demo.

Also my aolserver config file has more line
for .xtl file trnsmit application/x-tcl mime type

My question is with aolserver should I do more?

Please help me Don...

Collapse
Posted by Alfred Werner on
did you restart the server after you added the mime type?

is the page on a public URL?

Collapse
Posted by David Ghost on
Of course Alfred.

What you mean by public url?

If you mean accessible one, yes it is.

Have you ever tried Alfred?

Then how about your result?

If your case has no problem, then tell me your way.

Thank for reply

Collapse
Posted by Alfred Werner on
Take a look at http://www.onlinewatersolutions.com/tclet - I just got it running in under 2 minutes by copying the first example from the tclets site.

I think you're missing one or two things that are slowing you down. First - don't embed a file with a .tcl extension - but you DON'T have to add mime-types if you use the full EMBED syntax. I saved the tclet draghello.tcl file as draghello.tclet so the server wouldn't try to parse it.

Then for the Embed command:
      <EMBED
          TYPE="application/x-tcl"
          PLUGINSPAGE="http://www.tcl.tk/software/plugin/"
          FRAMEBORDER="NO"
          WIDTH="400"
          HEIGHT="400"
          SRC="http://www.onlinewatersolutions.com/draghello.tclet"
        >
        </EMBED>

Note that it has the mime-type and plugin info already available. As you can see on my site, it works fine with no changes to aolserver, just renaming one file fixed the "problem".

Collapse
Posted by Alfred Werner on
Final note - if you view source on that page you will see the embed's are inside object tags. Taking the object tags off does NOT make the tclets not work. I suppose in this case, they are just to provide additional robustness/info.
Collapse
Posted by David Ghost on
Thanks Alfred,

Still I'm in the middle of troubles.
My aolserver doesn't append any <OBJECT...> tag
Instead it just transmits as I typed.
I installed 3.x of aolserver, does it make difference?
....

Collapse
Posted by Alfred Werner on
I think what you need to try is:

copy one of the tclet pages EXACTLY from the tclet demo page ...

In other words do a 'save target as' when you right click a link, or when you have the page of an example tclet open do a file->save as ...

the ONLY modification you would do is change the references from .tcl files to .tclet files and save the tclet from that site with the .tclet extension. This is necessary because .tcl files are the native extension for code to execute on the server.

I don't like to assume, but it sounds like you're trying to take a shortcut somewhere that's not obvious to me with the little information you have sent and that you don't understand the shortcut you are taking ... As I said - try the example EXACTLY like it is on a page that works. Once that works you can start to experiment, and know that you can comfortably return to the working version if something breaks.

3.x is not an issue.

Collapse
Posted by David Ghost on
Thanks Alfred,

After attaching <OBJECT..> tag it works