Forum OpenACS Q&A: ADP versus HTML

Posted by Ola Hansson on you are building an OpenACS site from scratch with numerous (static) pages consisting of (hopefully) "magnet content" you want to collect comments and links. You ask yourself whether to use .html or .adp pages, or perhaps a mixture. These publishing decisions should be backed-up by some opinions from the community, so for instance:
  • To be able to collect comments on .html pages you'll have to sync with Postgres, right? This is beautiful and allows you to add links/comments on .html documents, but no "add a link/comment" will be offered on .adp pages unless you:
    1. stick to the same non-dynamic syntax in your .adp as you would use in .html ("/BODY" being the tag determining where to insert the comment stuff, see /tcl/ad-html.tcl)
    2. register ad_serve_html_page for /*.adp
    The .adp url gets synced allright (given you have the following in the static section of the /parameters file: ns_param IncludeRegexp ".html?$|.adp$") but I for one can't see why you should use .adp's if it weren't for the possibility to call procedures and stuff, like ad_footer for example. And I rather not call some "add_comments_here" procedure manually on every page if there are thousands. Any suggestions on how to best modify ad-html.tcl to enable comments on .adp's that are not using "/BODY" but ad_footer?

  • Also, Don, I read your posting where you said that the (much longed-for) site-wide-search implementation would probably be an out-of-db one. Thats great I suppose, because that would mean I can edit the procedure: ad_check_file_for_sync in /admin/static/static-syncer-ns-set.tcl so that it's not inserting copies of the static pages into the table static_pages. Gosh! I'm relieved (and I'm sure your superb backup script is too ;-) now that there's no need for keeping a copy of each page in the db for full-text indexing. Still, are there any disadvantages with the "out-of-db" search approach compared to PLS and the like?

  • Can Alta Vista and the others index .adp pages? (I guess the answer is yes...)

  • Pros/cons regarding .html/.adp. Thoughts?
Thanks Everyone!
Posted by Roberto Mello on
1) I personnally almost always use ADPs because I love using ad_header, ad_footer and custom-registered ADP tags. at (running OpenACS beta 2) I changed all the site's look and feel by changing the two ADP tags I use at all the ADP pages and restarting the server.

I changed ad-html.tcl to parse adp pages before stuffing them in the DB, so that it would find the regular body tags and insert the comments and links. That's how our site is running. However, those changes did not make in the CVS tree because we didn't want to branch off from aD's tree. I can make a patch and post it here, but it'll have to wait until tomorrow or saturday.

2) That's Don area :-)

3) Yes, search engines acn index ADPs. They only have problems with pages with ? and &, because they think they are CGI scripts or something. Go to Yahoo and search for "free linux" and our site will come up in first.

4) I use ADPs 99% of the time. They are much wore flexible and save me typing (which is a healthy thing).

Posted by Don Baccus on
As far as searching goes, the "out of database" comments have to do with whether or not the search index should be stored in the database,  or directly in the filesystem.  As to whether or not the indexing of one's static pages would continue to be done via visiting the static_pages table or not, I don't know.  We'll either have to teach an indexer to search PG tables (bboard, news_items, etc) or teach the scripts or PG triggers how to stuff the indexer's tables regardless of  how we treat static .html pages.
Posted by Ola Hansson on
Hello Roberto.

Thanks for the offering of posting your changes. Take your time though. There's no hurry since I'm only half-done with my peronal site, and I haven't got an Internet connection yet.

Oh yes, good of you to remind me of the registered ADP tags. They
enhance flexibility and should make future design changes a piece of cake.

By the way Roberto, I want to say that you guys are really good at making documentation crystal clear so that rookies like myself can get going in no time!

Posted by Ola Hansson on
Hi Don!
Regardless of wheter or not the search index is stored in the database, can I just skip stuffing copies of the content pages in the db? Or is that depending on what concept of doing searches is chosen?
Posted by Dave Bauer on

I am interested in the changes you made to add comments to adp pages. I am working on creating my site will all adp pages right now.
I was going to convert all the tcl pages to adp, but that will probably not happen before OpenACS 4.0 is available.

Posted by Matthew Braithwaite on
Parsing the ADPs before stuffing them into the database sounds like the Right Thing to me. But if you don't feel like branching, this works:
<%= [mab_page_header "<title>Page Title</title>"] %>
...where mab_page_header is some function you've written that strips out the title tags. I hear you gagging, but it does the job. As long as the stuffer sees <title> somewhere, it doesn't care too much about the context.

And of course you can always make your footer function DTRT for General Comments/Links. I agree it would be better to have it all done for you by ad_serve_html_page.

There's also an abstract URL issue here, which I asked about a while ago on the mailing list. I'll reproduce it here:

Another problem in this mess is that the process of stuffing static content into the database includes the extension. Will it be hard to make this play with abstract URLs? My worry is that if an adp is invoked abstractly (without the .adp extension) and it calls gc_insert_comments_here or whatever, that proc won't have a means of determining the actual file name that it's running under (as distinct from the URL), and that as a result it won't find its comments, because they are indexed under the file name, not the abstract URL.
I use abstract URLs for everything, so I would much rather that commments/links were indexed in the database by abstract URL. But I don't really know for sure whether this is broken or not.