[PHPTAL] Using PHPTAL with index.php?page=... thing
Levi Stanley
levi at eneservices.com
Mon Jan 21 12:07:15 CET 2008
Actually, phptal should only be used for the presentation of the data.
>
> your controller and models, should do most of the work you want.
>
> Here is a snippet of my index.php aka navigation controller:
>
> *...
> * if (isset($__xml_attributes['redirect'])){
> print header("Location: {$__xml_attributes['redirect']}");
> exit;
> } else if (isset($__xml_attributes['execute'])) {
> $benchmark->start('loading-sub-controller-section');
>
> include_once("controllers/{$__xml_attributes['execute']}.php");
> $benchmark->stop('loading-sub-controller-section');
> }
> *...
>
> *Nevermind the benchmark stuff, I like to know how long everything takes
> to run.
>
>
> On Jan 21, 2008 5:27 AM, Anton Andrievskij < x.meglio at gmail.com> wrote:
>
> > Thanks you; I got your idea, but it seems that I can't execute PHP
> > scripts from templates using PHPTAL (?)
> >
> > Anton
> >
> >
> > On Jan 21, 2008 12:13 PM, Levi Stanley < levi at eneservices.com> wrote:
> >
> > > Sorry, forgot to change the email, I was sending this from.
> > >
> > > Read below:
> > >
> > > ---------- Forwarded message ----------
> > > Date: Jan 21, 2008 5:08 AM
> > > Subject: Re: [PHPTAL] Using PHPTAL with index.php?page=... thing
> > > To: Template Attribute Language for PHP <phptal at lists.motion-twin.com>
> > >
> > >
> > > Hmm, kind of sounds like the system I built. I have a
> > > site-controller.xml file:
> > >
> > > <site-controller>
> > > *...*
> > > <warning-page use-page="warning-page.xhtml"
> > > execute="display-page" record-page="true" />
> > > <send-to template-id="1">
> > > <page alias="main-page" use-page="main-page.xhtml"
> > > execute="main-page" record-page="true" />
> > > <page alias="join-page" use-layout=" join-page.xhtml"
> > > execute="join-page" record-page="true">
> > > *...*
> > > </send-to>
> > > </site-controller>
> > >
> > > My system, I can have multiple templates, identified by the
> > > template-id, use-page, and use-layout, this just tell me what page view to
> > > use, and the execute attribute tells me what php file to execute,
> > > display-page is a generic display script. The record-page attribute,
> > > defines if I should record traffic information for that page or not.
> > >
> > > My directory structure looks like this:
> > >
> > > /www/sites/mysite.com/application -- usually
> > > the controller resides here index.php
> > > /www/sites/mysite.com/application/controllers -- this houses
> > > your php code display-page, join-page etc.
> > > /www/sites/mysite.com/application/views -- this houses
> > > your views
> > > /www/sites/mysite.com/application/models -- this houses the
> > > sites BL objects, etc.
> > > /www/sites/mysite.com/application/layouts -- This houses
> > > your layouts, mostly header fooder stuff.
> > > /www/sites/mysite.com/application/components -- These are certain
> > > XHTML & javascript items you keep using throughout the site
> > > /www/sites/mysite.com/cache -- This is
> > > just the place I keep the code that phptal generates.
> > > /www/sites/mysite.com/libraries --
> > > interesting enough, there are libraries that are used for all the sites in
> > > /www/libraries, however, you can override these libraries in this library,
> > > this is done this way, so any changes I make for this site, won't break the
> > > other sites I have that are up and running.
> > > /www/sites/mysite.com/configurations -- Well in my
> > > system, I use propel, so I have the site-controller, and the datasource
> > > information here
> > >
> > > I have two kinds of controllers, a navigation controller, and a page
> > > controller. The navigation controller, handles authentication, and sending
> > > people from one page to the next, also it has inside of it an access
> > > handler, so if a page, has resources, it checks to see if you are allowed to
> > > use those resources, and grants you access or denies you. Needless to say,
> > > the page controller, can't work without going through the navigation
> > > controller.
> > >
> > > I hope that gives you some ideas.
> > >
> > > Best regards,
> > > Levi
> > >
> > > On Jan 21, 2008 4:12 AM, Anton Andrievskij < x.meglio at gmail.com>
> > > wrote:
> > >
> > > > Hi, PHPTAL users.
> > > >
> > > > (Sorry for my bad English as I'm from Ukraine)
> > > >
> > > > I write this letter to ask about what the best idea about how to use
> > > > the PHPTAL engine with
> > > > the standard PHP site engine technology like this:
> > > >
> > > > www.mysite.com/index.php?page=login
> > > > www.mysite.com/index.php?page=faq
> > > > www.mysite.com/index.php?page=subscrib
> > > > and so on...
> > > >
> > > > I'm going to build index.html template and run it from index.phppage, but then
> > > > I have different code to be executed on different pages like
> > > > login.php , faq.php, subscribe.php and so on.
> > > >
> > > > So I have to have index.html, login.html, faq.html and subscrib.htmltemplates, but also
> > > > I want to have index.php, faq.php, subscrib.php pages with some code
> > > > to be executed.
> > > >
> > > > How can I join such things together?
> > > >
> > > > I'm really waiting for any answer or advice and any comments may
> > > > help.
> > > >
> > > > Thanks in advance,
> > > > Anton Andriyevskyy
> > > > _______________________________________________
> > > > PHPTAL mailing list
> > > > PHPTAL at lists.motion-twin.com
> > > > http://lists.motion-twin.com/mailman/listinfo/phptal
> > > >
> > > >
> > >
> > >
> > > _______________________________________________
> > > PHPTAL mailing list
> > > PHPTAL at lists.motion-twin.com
> > > http://lists.motion-twin.com/mailman/listinfo/phptal
> > >
> > >
> >
> > _______________________________________________
> > PHPTAL mailing list
> > PHPTAL at lists.motion-twin.com
> > http://lists.motion-twin.com/mailman/listinfo/phptal
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.motion-twin.com/pipermail/phptal/attachments/20080121/4c0fdc5c/attachment.htm
More information about the PHPTAL
mailing list