Forum OpenACS Q&A: integrating i.e. blogger include into etp...

I would like to integrate information from dynamic packages like blogger or news into etp... Did anybody do that already?
Collapse
Posted by Dave Bauer on
David,

Can you explain what you mean by "integrate"? OpenACS.org combines information from News, Forums, and several ETP instances on the home page. It uses templates that are included into the etp template for a custom application we created.

You can use the include tag in the etp templates such as article-index or article-content to add information. The lars-blogger package is nice because it comes with an includable template called blog which you can include in any adp.

If you want to include dynamic pages inside ETP content, there is no way to do that now.

Collapse
Posted by Lars Pind on
David,

What I did for http://www.collaboraid.biz was to create an ETP  content type, which takes fully templated ADP code, and runs it through the templating system.

Then I have this in ETP on the http://www.collaboraid.biz/developer/ page:

<div style="float: right; width: 50%; border: 1px solid #cccccc; padding: 8px;">
<%=[lars_blog_get_as_string -url "/developer/blog"] %>
</div>

The only downside is that you have to be careful with what you put in those pages, since it will get interpreted, and thus may break.

Here's the code that handles it:

etp::get_page_attributes
foreach element { content } {
    if { [catch {
        set code [template::adp_compile -string $pa($element)]
        set pa($element) [template::adp_eval code]
    } errMsg] } {
        global errorInfo
        ns_log Error "$errMsg while evaluating ETP ADP page at [ad_return_url]: \n$errorInfo"
    }
}

Collapse
Posted by Dave Bauer on
Lars,

Why? :) This obviously is only useful if the content editors are also OpenACS hackers. Its much easier to include the blog includable template in the etp application template and much safer.

Eventually we want to add safe adp tags similar to what the old CMS package did. Then we can parse for those tags in ETP content. Either way, I would still like to see that kind of thing in the content template. Another goal of mine is to allow editing of templates through the web interface. This would allow those without CVS access to change the design of the pages.

Anyway both of these methods will work.

Collapse
Posted by David Kuczek on
Hey Dave,

can you make an example of how I could do this... I don't care which way to go as long as I can I can include dynamic content into etp content through the browser.

"Another goal of mine is to allow editing of templates through the web interface. This would allow those without CVS access to change the design of the pages."

oacs 3.2.5 had the file-manager, where you could change files through a browser. Is there anything similar in oacs 4.6?

Collapse
Posted by Dave Bauer on
David,

Can you be a litle more clear as to why you need this? It is definitely a good way to break your web site unless you add code to check what dynamic code is going into the pages.

The only reason I can see to include dynamic content inside the etp content is if you would be changing what dynamic content you were displaying.

I really think just adding an include to the etp templates is a better solution.

Collapse
Posted by David Kuczek on
Hey Dave,

thanks for the quick response... I would like to integrate blogger into our new starting page. Basically there will be content on the left and the most current x blog entries on the right.

Collapse
Posted by Dave Bauer on
David.

Easiest way to do that is to edit the etp *-index.adp template for your application. The defaule one is article-index.adp

Just add something like <include src="/packages/lars-blogger/www/blog" url="/blog/">

That's it.

Collapse
Posted by David Kuczek on
Dave,

thanks... that's very good for the beginning. But what if I might wanna integrate it at a certain position and don't wanna mess around with a shell. I mean I would like to go to my etp, edit my page and say: Here I wanna have the x most current blogs, here maybe the x newest bboard posts etc.

Collapse
Posted by Jun Yamog on
Hi David,

It maybe that you my have to create a custom tag.  Say
<recent item="blog" num="10">.  Put that tag into etp and you have to parse the etp content.  Although I find it not good to have content using those.  Since we should try to make content as content and layout to templates.

I guess a better idea is to put that into template and have the template be editable by the browser.  Current ad CMS and bcms-ui-base is able to edit it via browser.  No fancy stuff still adp stuff and textarea.  Then it saves to the db as like any content item and the content type is content_template.  You then write this template to a dir.  Just write the string into file.  Then when you serve the page, look up which template in the db.  And just ad_returntemplate to that file.

I guess the suggestion above will require some real coding.  But it does work for me.  I don't however have any custom tags.

Collapse
Posted by Nagita Karunaratne on
Lars,

How much of collaboraid.biz is implemented using ETP?