[PHP] Design question

2011-02-05 Thread li...@pruimphotography.com

Morning everyone!

I have a design question... No it's not about the interior of my  
house... although I could use some help with that as well...


I am working on a framework for my own use (And maybe one day will  
beat out the popular frameworks! Hey I can dream right? :)) and to  
increase my knowledge.


Here's my current index page:

DJ_doctype(HTML4S);
DJ_head(Double J FrameWork, $cfgCss, $cfgMeta);
DJ_modules(navigation, option);
DJ_page(main_content.html, mainContent);
DJ_dbconnect($cfgDatabase);

DJ_footer(copywrite, Double J Web Design);

It all works perfectly but I'm starting to question having a bunch of  
function calls like that or should I simply have a big master  
DJ_displayPage() call?


or should I have my framework create the html files? Has anyone gone  
down this road before? any pitfalls I should watch out for that aren't  
in google yet? :)


Thanks everyone!

Jason Pruim


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Design question

2011-02-05 Thread Ashley Sheridan
On Sat, 2011-02-05 at 11:11 -0500, li...@pruimphotography.com wrote:

 Morning everyone!
 
 I have a design question... No it's not about the interior of my  
 house... although I could use some help with that as well...
 
 I am working on a framework for my own use (And maybe one day will  
 beat out the popular frameworks! Hey I can dream right? :)) and to  
 increase my knowledge.
 
 Here's my current index page:
 
 DJ_doctype(HTML4S);
 DJ_head(Double J FrameWork, $cfgCss, $cfgMeta);
 DJ_modules(navigation, option);
 DJ_page(main_content.html, mainContent);
 DJ_dbconnect($cfgDatabase);
 
 DJ_footer(copywrite, Double J Web Design);
 
 It all works perfectly but I'm starting to question having a bunch of  
 function calls like that or should I simply have a big master  
 DJ_displayPage() call?
 
 or should I have my framework create the html files? Has anyone gone  
 down this road before? any pitfalls I should watch out for that aren't  
 in google yet? :)
 
 Thanks everyone!
 
 Jason Pruim
 
 


I guess it all depends on what you need. A little while back there was a
discussion on the list about whether or not to leave all content dynamic
or have the PHP CMS create the various .html pages required. There are
pros and cons to each method.

As for the various calls vs a single call to display the page, that
depends on how you will be using it. Personally, I'd prefer using one
call to something like your call to DJ_displayPage() which itself can
accept various parameters or an array of parameters that then makes the
more individual calls to the other functions. Anything to reduce typing
while still being maintainable is never a bad thing in my book, unless
it becomes a crazy long list of chained calls!

Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] Design question

2011-02-05 Thread Paul M Foster
On Sat, Feb 05, 2011 at 11:11:57AM -0500, li...@pruimphotography.com wrote:

 Morning everyone!
 
 I have a design question... No it's not about the interior of my
 house... although I could use some help with that as well...
 
 I am working on a framework for my own use (And maybe one day will
 beat out the popular frameworks! Hey I can dream right? :)) and to
 increase my knowledge.
 
 Here's my current index page:
 
 DJ_doctype(HTML4S);
 DJ_head(Double J FrameWork, $cfgCss, $cfgMeta);
 DJ_modules(navigation, option);
 DJ_page(main_content.html, mainContent);
 DJ_dbconnect($cfgDatabase);
 
 DJ_footer(copywrite, Double J Web Design);

Copywrite should be copyright in this context.

 
 It all works perfectly but I'm starting to question having a bunch of
 function calls like that or should I simply have a big master
 DJ_displayPage() call?

Is this index page a front controller, or are there separate page
controllers? If the calls are all *identical*, then you can stuff them
into a single function call. The biggest problem with this is variable
visibility. You'll have to monitor that and decide if it's worth it. In
my case, I use page controllers where all the important variables are
declared. If I put a render() function at the bottom, I'd have to pass
in all those variables (on the stack) rather than simply have them
visible to the template page that I include() at the bottom of the
page controller.

 
 or should I have my framework create the html files? Has anyone gone
 down this road before? any pitfalls I should watch out for that aren't
 in google yet? :)

Some of this depends on your overall application architecture, which is
where the front contoller/page controller question above comes from.

Paul

-- 
Paul M. Foster
http://noferblatz.com


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Design question

2011-02-05 Thread Jason Pruim


On Feb 5, 2011, at 11:19 AM, Ashley Sheridan wrote:


On Sat, 2011-02-05 at 11:11 -0500, li...@pruimphotography.com wrote:


Morning everyone!

I have a design question... No it's not about the interior of my
house... although I could use some help with that as well...

I am working on a framework for my own use (And maybe one day will
beat out the popular frameworks! Hey I can dream right? :)) and to
increase my knowledge.

Here's my current index page:

DJ_doctype(HTML4S);
DJ_head(Double J FrameWork, $cfgCss, $cfgMeta);
DJ_modules(navigation, option);
DJ_page(main_content.html, mainContent);
DJ_dbconnect($cfgDatabase);

DJ_footer(copywrite, Double J Web Design);

It all works perfectly but I'm starting to question having a bunch of
function calls like that or should I simply have a big master
DJ_displayPage() call?

or should I have my framework create the html files? Has anyone gone
down this road before? any pitfalls I should watch out for that  
aren't

in google yet? :)

Thanks everyone!

Jason Pruim





I guess it all depends on what you need. A little while back there  
was a
discussion on the list about whether or not to leave all content  
dynamic

or have the PHP CMS create the various .html pages required. There are
pros and cons to each method.


I'll definitely be looking that thread up! I got a little behind in my  
reading and must have missed it.


As for the various calls vs a single call to display the page, that
depends on how you will be using it. Personally, I'd prefer using one
call to something like your call to DJ_displayPage() which itself can
accept various parameters or an array of parameters that then makes  
the
more individual calls to the other functions. Anything to reduce  
typing

while still being maintainable is never a bad thing in my book, unless
it becomes a crazy long list of chained calls!


That last sentence is the kicker... That's where it gets hard hehe.  
When is too much too much? And I am guessing that is a decision that  
only I as the programmer can make... At least until someone uses my  
framework and complains about it! :)


Thanks Ash!


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Design question

2011-02-05 Thread Jason Pruim


On Feb 5, 2011, at 6:46 PM, Paul M Foster wrote:

On Sat, Feb 05, 2011 at 11:11:57AM -0500, li...@pruimphotography.com  
wrote:



Morning everyone!

I have a design question... No it's not about the interior of my
house... although I could use some help with that as well...

I am working on a framework for my own use (And maybe one day will
beat out the popular frameworks! Hey I can dream right? :)) and to
increase my knowledge.

Here's my current index page:

DJ_doctype(HTML4S);
DJ_head(Double J FrameWork, $cfgCss, $cfgMeta);
DJ_modules(navigation, option);
DJ_page(main_content.html, mainContent);
DJ_dbconnect($cfgDatabase);

DJ_footer(copywrite, Double J Web Design);


Copywrite should be copyright in this context.



It all works perfectly but I'm starting to question having a bunch of
function calls like that or should I simply have a big master
DJ_displayPage() call?


Is this index page a front controller, or are there separate page
controllers? If the calls are all *identical*, then you can stuff them
into a single function call. The biggest problem with this is variable
visibility. You'll have to monitor that and decide if it's worth it.  
In

my case, I use page controllers where all the important variables are
declared. If I put a render() function at the bottom, I'd have to  
pass

in all those variables (on the stack) rather than simply have them
visible to the template page that I include() at the bottom of the
page controller.


Right now in my simple test pages the variables are very standard but  
I will keep an eye on it to see if I need to change to a different  
system.


I'm leaning more towards doing a page controller. I've always liked  
the way that I can simplify the display of pages especially with  
regards to updates in the layout by just having a index page that  
controls the entire site.






or should I have my framework create the html files? Has anyone gone
down this road before? any pitfalls I should watch out for that  
aren't

in google yet? :)


Some of this depends on your overall application architecture, which  
is

where the front contoller/page controller question above comes from.


Thanks for the insight! I'll be keeping these points in mind in my work!



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Design question.

2002-09-21 Thread Chuck PUP Payne

Hi,

I have a question. I been working a personal project that I am want to make
a like simpler. I have several pages have in which I have place the
information to connect to my database, whick is getting old.

What I am wanting to do is create file like most do, a config, but I want to
know which is better, config.php or config.inc. I know there not much
different from what I have read but I am wanting to know which gives more
protection. And what recommendation would you give on set it up? I am only
asking because I am at some point wanting to release my project to public.

Chuck Payne
Magi Design and Support


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Design question.

2002-09-21 Thread Justin French

Hi,

I place name all my included files *.inc... I place them all in a folder
/inc/ and place a .htaccess file in that directory to restrict the files
being served of HTTP:

Files ~ \.inc$
Order Allow,Deny
Deny from all
/Files

Another option would be to place them in a folder ABOVE your web root, so
that Apache can't serve them -- if you have that option.


This does a few things for me:

1. I know that all *.php files are intended to be served direct to the user
through a web browser, and I know that all .inc files are code fragments,
not intended to be run out of context.

2. As long as Apache is configured properly, no one will see any passwords n
stuff.


Cheers,

Justin



on 22/09/02 11:55 AM, Chuck PUP Payne ([EMAIL PROTECTED]) wrote:

 Hi,
 
 I have a question. I been working a personal project that I am want to make
 a like simpler. I have several pages have in which I have place the
 information to connect to my database, whick is getting old.
 
 What I am wanting to do is create file like most do, a config, but I want to
 know which is better, config.php or config.inc. I know there not much
 different from what I have read but I am wanting to know which gives more
 protection. And what recommendation would you give on set it up? I am only
 asking because I am at some point wanting to release my project to public.
 
 Chuck Payne
 Magi Design and Support
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Design question.

2002-09-21 Thread Chris Shiflett

This explanation from Justin is worth saving.

I also like to call all of my included modules *.inc, and I prefer to 
store them outside of document root.

However, if you want to keep all of your files together, the .htaccess 
file shown below is the best way to restrict direct access to modules. 
Some people make the mistake of simply making *.inc files considered PHP 
by Apache (claiming it is better to execute them than to have their 
source code displayed), but this gives attackers the opportunity to 
execute your modules out of context - a very dangerous approach.

One extra note worth adding is that you should add this configuration to 
your httpd.conf if you are the Web server administrator. This will keep 
you from having to remember the .htaccess file everywhere. Justin's 
method is best for when you do not have this option.

Chris

Justin French wrote:

I place name all my included files *.inc... I place them all in a folder
/inc/ and place a .htaccess file in that directory to restrict the files
being served of HTTP:

Files ~ \.inc$
Order Allow,Deny
Deny from all
/Files

Another option would be to place them in a folder ABOVE your web root, so
that Apache can't serve them -- if you have that option.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Design question.

2002-09-21 Thread Chuck PUP Payne

Thanks guys. That really helpful.

Chuck Payne

On 9/21/02 10:16 PM, Chris Shiflett [EMAIL PROTECTED] wrote:

 This explanation from Justin is worth saving.
 
 I also like to call all of my included modules *.inc, and I prefer to
 store them outside of document root.
 
 However, if you want to keep all of your files together, the .htaccess
 file shown below is the best way to restrict direct access to modules.
 Some people make the mistake of simply making *.inc files considered PHP
 by Apache (claiming it is better to execute them than to have their
 source code displayed), but this gives attackers the opportunity to
 execute your modules out of context - a very dangerous approach.
 
 One extra note worth adding is that you should add this configuration to
 your httpd.conf if you are the Web server administrator. This will keep
 you from having to remember the .htaccess file everywhere. Justin's
 method is best for when you do not have this option.
 
 Chris
 
 Justin French wrote:
 
 I place name all my included files *.inc... I place them all in a folder
 /inc/ and place a .htaccess file in that directory to restrict the files
 being served of HTTP:
 
 Files ~ \.inc$
Order Allow,Deny
Deny from all
 /Files
 
 Another option would be to place them in a folder ABOVE your web root, so
 that Apache can't serve them -- if you have that option.
 
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Design question.

2002-09-21 Thread @ Edwin

(Sorry if I've already sent this.)

I agree. But, I don't really see any problem having *.inc files as *.inc.php
(so that they'll be executed by Apache) esp. IF the config file have only
this: (Even if this is executed nothing shows up...)

?php

  $my_super_user = 'blahblah';
  $my_super_password = 'blahblahblah';

?

I just thought this is worth knowing esp. if there's no way you can use
.htaccess. (Of course, if you can't use .htaccess, you might want to change
ISPs or set up your own server but that is for a different topic :)

- E

 This explanation from Justin is worth saving.

 I also like to call all of my included modules *.inc, and I prefer to
 store them outside of document root.

 However, if you want to keep all of your files together, the .htaccess
 file shown below is the best way to restrict direct access to modules.
 Some people make the mistake of simply making *.inc files considered PHP
 by Apache (claiming it is better to execute them than to have their
 source code displayed), but this gives attackers the opportunity to
 execute your modules out of context - a very dangerous approach.

 One extra note worth adding is that you should add this configuration to
 your httpd.conf if you are the Web server administrator. This will keep
 you from having to remember the .htaccess file everywhere. Justin's
 method is best for when you do not have this option.

 Chris

 Justin French wrote:

 I place name all my included files *.inc... I place them all in a folder
 /inc/ and place a .htaccess file in that directory to restrict the files
 being served of HTTP:
 
 Files ~ \.inc$
 Order Allow,Deny
 Deny from all
 /Files
 
 Another option would be to place them in a folder ABOVE your web root, so
 that Apache can't serve them -- if you have that option.
 


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php