[PHPTAL] Using PHPTAL with index.php?page=... thing

2008-01-21 Thread Anton Andrievskij
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.php page, 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@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal


Fwd: [PHPTAL] Using PHPTAL with index.php?page=... thing

2008-01-21 Thread Levi Stanley
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@lists.motion-twin.com


Hmm, kind of sounds like the system I built.  I have a site-controller.xmlfile:

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 [EMAIL PROTECTED] 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.php page, 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@lists.motion-twin.com
 http://lists.motion-twin.com/mailman/listinfo/phptal


___
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal


Re: [PHPTAL] Using PHPTAL with index.php?page=... thing

2008-01-21 Thread Levi Stanley
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  [EMAIL PROTECTED] 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  [EMAIL PROTECTED] 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@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  [EMAIL PROTECTED]
   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

Re: [PHPTAL] Using PHPTAL with index.php?page=... thing

2008-01-21 Thread Anton Andrievskij
Thanks, I'll read.

Anton

On Jan 21, 2008 1:39 PM, Levi Stanley [EMAIL PROTECTED] wrote:

 I ithink you might be looking for something like this:

 http://www.phpmvc.net/docs/guides/guidesIdx.php?doc=adv-pg-layout-tal


 On Jan 21, 2008 6:32 AM, Anton Andrievskij [EMAIL PROTECTED] wrote:

  Ok, you told the same thing but in shortest and more simple words.
  Thanks you.
 
  PHPTAL works best if you design your application using MVC pattern
  Where can I read professional comments and how it works?
 
  Thanks,
  Anton
 
 
  On Jan 21, 2008 1:30 PM, Anton Andrievskij [EMAIL PROTECTED]  wrote:
 
   Ok, I found some idea about how to solve my problem.
   The method is very easy and applicable to use both PHPTAL and PHP CMS
   engine technology
   described in my first letter (which is question).
  
   The idea is to have only one index.html template with the site layout,
   and then to have different
   login.html, faq.html, subscribe.html (and so on) layouts to insert
   into index.html layout.
   Take into account that I do not want to rewrite site layout in all
   templates, I want to have it only in index.html.
  
   So I build index.html, and then I build some library with macroses for
   each page. I'm planning to use them then
   using metal:use-macro attribute.
  
   So the steps are:
  
  
  1. Create index.html template for page layout (navigation, news
  and so on) and templates for each page using metal:define-macro for 
   each
  page
  2. Create $template = new PHPTAL(index.html) in your index.phpfile 
   and define variables in $template to use to render site's layout
  3. Define something like $template-page and use it in
  metal:use-macro tag to insert specific page content
  4. Create faq.php, login.php and other files so you will add
  specific $template-pagespecificvariable1,  
   $template-pagespecificvariable2
  (...) values
  5. Use specific variable values in specific macroses.
  6. In index.php include specific pageX.php (index.php?page=pageX).
  So your pageX will add specific variable values to the $template
  7. Render page using $template object
  
  
   Any comments may help to improve the idea.
  
   Anton
  
  
   On Jan 21, 2008 1:07 PM, Levi Stanley  [EMAIL PROTECTED]  wrote:
  
   
   
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  [EMAIL PROTECTED]
 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  [EMAIL PROTECTED]
  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@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