Hello; I have this code that works fine in a Page Template: <html> <body> <table width="100%" align="center" class="text" border="3" cellspacing="5" bgcolor="#E694FE" bordercolor="#D24BFA" bordercolorlight="#DD77FB" bordercolordark="#C512FA"><tr><td> <span metal:use-macro="here/en-us/Quotes/10/macros/quote"></span><br /> <div align="center"><span class="text"> <a href="All_Quotes.pt" target="_top"><b>Show me all the quotes!</b></a> </span></div> </td></tr></table> </body> <html> But when I try to make it work in an External Method like this: stuff = '<html>\n' stuff = stuff + '<body>\n' stuff = stuff + '<table width="100%" align="center" class="text" border="3" cellspacing="5" bgcolor="#E694FE" bordercolor="#D24BFA" bordercolorlight="#DD77FB" bordercolordark="#C512FA"><tr><td>\n' stuff = stuff + '<span metal:use-macro="here/en-us/Quotes/10/macros/quote"></span><br />\n' stuff = stuff + '<div align="center"><span class="text">\n' stuff = stuff + ' <a href="All_Quotes.pt" target="_top"><b>Show me all the quotes!</b></a>\n' stuff = stuff + '</span></div>\n' stuff = stuff + '</td></tr></table>\n' stuff = stuff + '</body>\n' stuff = stuff + '<html>\n' it doesn't show the quote from this line: <span metal:use-macro="here/en-us/Quotes/10/macros/quote"></span><br /> but it shows the rest of the table and the link at the end. Why is that? Have I lost the context along the way? How do I preseve the context going into an External Method? TIA, Javier ____________________________________________________________________________________ Need a quick answer? Get one in minutes from people who know. Ask your question on www.Answers.yahoo.com
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 - --On 8. Dezember 2006 10:38:25 -0800 Javier Subervi <javier_subervi@yahoo.com> wrote:
<html>
But when I try to make it work in an External Method like this:
stuff = '<html>\n' stuff = stuff + '<body>\n' stuff = stuff + '<table width="100%" align="center" class="text" border="3" cellspacing="5" bgcolor="#E694FE" bordercolor="#D24BFA" bordercolorlight="#DD77FB" bordercolordark="#C512FA"><tr><td>\n' stuff = stuff + '<span metal:use-macro="here/en-us/Quotes/10/macros/quote"></span><br />\n' stuff = stuff + '<div align="center"><span class="text">\n' stuff = stuff + ' <a href="All_Quotes.pt" target="_top"><b>Show me all the quotes!</b></a>\n' stuff = stuff + '</span></div>\n' stuff = stuff + '</td></tr></table>\n' stuff = stuff + '</body>\n' stuff = stuff + '<html>\n'
An external method is not a ZPT. The external method returns just HTML. Why and how should Zope treat interpret *something* inside the HTML generated by the external method as macro? If you want a macro, the called object has to be a ZPT - nothing else. - -aj -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (Darwin) iD8DBQFFebJoCJIWIbr9KYwRAvpcAJ93PVwsUnywwOEDze4o2X0jkzVm1ACfdcF/ RcrfXZEFwbHef++Uffr2TmE= =QOIv -----END PGP SIGNATURE-----
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 - --On 8. Dezember 2006 19:43:52 +0100 Andreas Jung <lists@zopyx.com> wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
- --On 8. Dezember 2006 10:38:25 -0800 Javier Subervi <javier_subervi@yahoo.com> wrote:
<html>
But when I try to make it work in an External Method like this:
stuff = '<html>\n' stuff = stuff + '<body>\n' stuff = stuff + '<table width="100%" align="center" class="text" border="3" cellspacing="5" bgcolor="#E694FE" bordercolor="#D24BFA" bordercolorlight="#DD77FB" bordercolordark="#C512FA"><tr><td>\n' stuff = stuff + '<span metal:use-macro="here/en-us/Quotes/10/macros/quote"></span><br />\n' stuff = stuff + '<div align="center"><span class="text">\n' stuff = stuff + ' <a href="All_Quotes.pt" target="_top"><b>Show me all the quotes!</b></a>\n' stuff = stuff + '</span></div>\n' stuff = stuff + '</td></tr></table>\n' stuff = stuff + '</body>\n' stuff = stuff + '<html>\n'
An external method is not a ZPT. The external method returns just HTML. Why and how should Zope treat interpret *something* inside the HTML generated by the external method as macro? If you want a macro, the called object has to be a ZPT - nothing else.
- -aj
If you want something different: you must instantiate a Pagetemplate inside your external method, add the content through the related API and let the pagetemplate render the content. But there is usually no need for such an approach. Somehow you're trying to do something the wrong way round. - -aj -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (Darwin) iD8DBQFFebMxCJIWIbr9KYwRAk3/AKDMiRTk9IuVwSY2p8n3uICW5+GXogCg2kQD WRQ7QStI2Mubir5BFaSslVU= =WndM -----END PGP SIGNATURE-----
participants (2)
-
Andreas Jung -
Javier Subervi