-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Guillaume Lecanu schrieb: > Le mercredi 23 avril 2008 à 17:49 +0200, Christoph Frick a écrit : > >> On Wed, Apr 23, 2008 at 05:07:47PM +0200, Guillaume Lecanu wrote: >> >> >>> Like index.php and about.php have the same menu, I have added a >>> /templates/macros.html page. In this macros.html, I have added the >>> menu div with the attribute metal:define-macro="menu". In the 2 >>> others templates pages, I have set the menu sample to uses the >>> macros.html version, for that I have used >>> metal:use-macro="macros.html/menu" >> You should read up the parts about define-slot and fill-slot in the >> phptal docs. > > Yes I have read it, but I haven't really understand the concept of > slots. > > But I have just found a solution with macros. > I know have a /templates/template.html with the proper html/head/body > and I call the macro on the body tag I call the content of the other > page : > metal:use-macro="$template/content" > > $template is the template file name of the template to see (from > $_SERVER['SCRIPT_NAME']) > > Like that, all working like I want, > > Thanks for your help !
hi, try following construct (works fine for me): - - all my references are like href="?view=home" or href="index.php" (access to all template-files is limited to localhost) - - index.php: $template = new PHPTAL(Controller::getView('view')); // result of Controller::getView('view') for href="?view=home" is 'path/to/home.html' - - layout.html: <span metal:define-macro="page" tal:omit-tag=""> <html> <head>...</head> <body> <span metal:use-macro="path/to/header.html/header">Include Header</span> <span metal:use-macro="path/to/nav.html/nav">Include Navigation</span> <span metal:define-slot="content">Include Content</span> <span metal:define-slot="contentNav">Include ContentNav</span> </body> </html> </span> - - home.html <div metal:use-macro="path/to/layout.html/page"> <div metal:fill-slot="content" tal:omit-tag=""> content </div> <div metal:fill-slot="contentNav" tal:omit-tag=""> contentNav </div> </div> greetings, thomas mueller -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFIEPwUxu7FFJqGq7cRAjFHAJ92CwXAaGxXViKTIvKk08Js/1KO/QCgj88B /yxB4j7puxzske8S8bPsmbc= =6p8a -----END PGP SIGNATURE----- _______________________________________________ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal