Forum OpenACS Development: Re: Basic tcl syntax question

Collapse
Posted by Jim Lynch on
keep on keepin on...

yes tcl is very different from php, and while you're coming up to speed you'll run into a buncha stuff...

proc foo {a b} { return "$a $b" }

doc_return 200 "text/plain" [foo "ayyy" "beee bayyybee"]

try something like that... or, use acs-templating:

foo.tcl:

ad_page_contract {test/exercise foo proc} -properties {
  out : onevalue
}

proc foo {a b} {return "$a $b"}

set out [foo "ayy bee" "bayyy bee"]

and, foo.adp:

@out@

-or-:

foo.adp (foo.tcl as above):

<master>

<ul>
  <li>@out@</li>
</ul>


Collapse
Posted by Jim Lynch on
Oh, and the template files go in yourOacsInstance/packages/yourPackage/www/

And if you have foo.tcl and foo.adp in there, then you would mount a new instance of yourpackage somewhere, using the site map, say it's mounted on /pkg.

then, you can access it as http://your.site/pkg/foo