manage_AddProduct for ZPT
Hi; I would like to do the equivalent of this: <dtml-call "manage_addProduct['OFSP'].manage_addFolder(id, title)"> in ZPT to create a page on-the-fly. Can it be done? TIA, beno
beno wrote:
Hi; I would like to do the equivalent of this:
<dtml-call "manage_addProduct['OFSP'].manage_addFolder(id, title)">
in ZPT to create a page on-the-fly. Can it be done? TIA, beno
Hi, this should do it for you: manage_addProduct['PageTemplates'].manage_addPageTemplate(id, title=None, text=None, REQUEST=None) /mj
At 11:43 AM 1/5/2003 +0100, you wrote:
beno wrote:
Hi; I would like to do the equivalent of this: <dtml-call "manage_addProduct['OFSP'].manage_addFolder(id, title)"> in ZPT to create a page on-the-fly. Can it be done? TIA, beno
Hi,
this should do it for you:
manage_addProduct['PageTemplates'].manage_addPageTemplate(id, title=None, text=None, REQUEST=None)
So I try this in a ZPT page: <p tal:replace="structure python:path(manage_addProduct['PageTemplates'].manage_addPageTemplate(id, title='testing', text=None, REQUEST=None))" /> but the error says *manage_addProduct is not defined*. What am I missing? TIA, beno
beno wrote:
At 11:43 AM 1/5/2003 +0100, you wrote:
beno wrote:
Hi; I would like to do the equivalent of this: <dtml-call "manage_addProduct['OFSP'].manage_addFolder(id, title)"> in ZPT to create a page on-the-fly. Can it be done? TIA, beno
Hi,
this should do it for you:
manage_addProduct['PageTemplates'].manage_addPageTemplate(id, title=None, text=None, REQUEST=None)
So I try this in a ZPT page:
<p tal:replace="structure python:path(manage_addProduct['PageTemplates'].manage_addPageTemplate(id, title='testing', text=None, REQUEST=None))" />
but the error says *manage_addProduct is not defined*. What am I missing? TIA, beno
Your path(...) is not a valid TAL-path-expression. You should do something like: <p tal:replace="structure python: here.manage_addProduct['PageTemplates'].manage_addPageTemplate(id, title='testing', text=None, REQUEST=None)" /> All in all your approach seems very strange to me! I wouldn't mix business logic into a PageTemplate... This is hard to maintain and read. Factor it out into a python-script and you will be happier... especially in 4 month or so...;) /mj
At 12:24 PM 1/5/2003 +0100, you wrote:
beno wrote:
At 11:43 AM 1/5/2003 +0100, you wrote:
beno wrote:
Hi; I would like to do the equivalent of this: <dtml-call "manage_addProduct['OFSP'].manage_addFolder(id, title)"> in ZPT to create a page on-the-fly. Can it be done? TIA, beno
Hi,
this should do it for you:
manage_addProduct['PageTemplates'].manage_addPageTemplate(id, title=None, text=None, REQUEST=None)
So I try this in a ZPT page: <p tal:replace="structure python:path(manage_addProduct['PageTemplates'].manage_addPageTemplate(id, title='testing', text=None, REQUEST=None))" /> but the error says *manage_addProduct is not defined*. What am I missing? TIA, beno
Your path(...) is not a valid TAL-path-expression. You should do something like:
<p tal:replace="structure python: here.manage_addProduct['PageTemplates'].manage_addPageTemplate(id, title='testing', text=None, REQUEST=None)" />
I tried that first...it didn't work. And yes, the above *does* work in other contexts.
All in all your approach seems very strange to me!
I'm being fancy here and this is a luxury.
I wouldn't mix business logic into a PageTemplate... This is hard to maintain and read. Factor it out into a python-script and you will be happier... especially in 4 month or so...;)
I'll go with that. Here's what I'm doing: Redirect the browser to a script with a value such as *index.pt* The script determines if *index.pt* exists. If it does not, it creates it and writes standardized content to the page template. That page template then calls another page template that *does* exist which has the real content of the page. Why? I build sites with inline frames. I want the content of the page to appear *both* in the inline frame *and* within a noframes tag to satisfy search engine spiders. I only want to write the content once. There is no need to write the calling page (*index.pt*) explicitly when I can do it programmatically. The page will be called from a navigation widget I create. So...How do I build it? TIA, beno
Hi benno, --On Sonntag, 5. Januar 2003 06:25 -0400 beno <zope@thewebsons.com> wrote:
Hi; I would like to do the equivalent of this:
<dtml-call "manage_addProduct['OFSP'].manage_addFolder(id, title)">
in ZPT to create a page on-the-fly. Can it be done? TIA,
Although it _could_ be done, it schould not be done. Unlike DTML, ZPT was created for strict as possible diversion of logic and content. Since manage_add* is logic, you should put it into a python script and call it during template publishing (if it outputs something essential as content) or before you call the template. Regards Tino
At 12:29 AM 1/6/2003 +0100, you wrote:
Hi benno,
--On Sonntag, 5. Januar 2003 06:25 -0400 beno <zope@thewebsons.com> wrote:
Hi; I would like to do the equivalent of this:
<dtml-call "manage_addProduct['OFSP'].manage_addFolder(id, title)">
in ZPT to create a page on-the-fly. Can it be done? TIA,
Although it _could_ be done, it schould not be done. Unlike DTML, ZPT was created for strict as possible diversion of logic and content. Since manage_add* is logic, you should put it into a python script and call it during template publishing (if it outputs something essential as content) or before you call the template.
Indeed, I intend to do just that...I'm only testing things and learning now. beno
participants (3)
-
beno -
Maik Jablonski -
Tino Wildenhain