php-general Digest 6 Feb 2011 05:19:30 -0000 Issue 7168
Topics (messages 311157 through 311165):
Design question
311157 by: lists.pruimphotography.com
311158 by: Ashley Sheridan
311164 by: Paul M Foster
311165 by: lists.pruimphotography.com
Bilingual strtotime()
311159 by: Alexis
311160 by: Per Jessen
311161 by: Alexis
311162 by: David Hutto
311163 by: David Hutto
Administrivia:
To subscribe to the digest, e-mail:
[email protected]
To unsubscribe from the digest, e-mail:
[email protected]
To post to the list, e-mail:
[email protected]
----------------------------------------------------------------------
--- Begin Message ---
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
--- End Message ---
--- Begin Message ---
On Sat, 2011-02-05 at 11:11 -0500, [email protected] 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
--- End Message ---
--- Begin Message ---
On Sat, Feb 05, 2011 at 11:11:57AM -0500, [email protected] 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
--- End Message ---
--- Begin Message ---
On Feb 5, 2011, at 11:19 AM, Ashley Sheridan wrote:
On Sat, 2011-02-05 at 11:11 -0500, [email protected] 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!
--- End Message ---
--- Begin Message ---
Hi,
Living in Canada, and being a bilingual country, I have data I am
processing which includes dates in both English and French.
I was wondering if there was a way to use the strtotime() function when
the months are in one or the other of the above two languages?
Just to add to it, for French, they may or may not have the various accents.
The data is in no specific order, so one could be in English, the next
in French, then back to English.
All I can think of, is to create an array to 'translate' the French
months into English, but I was wondering if there is an easier way? If
not, how in regular expressions, would I go about ignoring accents please?
Cheers
Alexis
--- End Message ---
--- Begin Message ---
Alexis wrote:
> Hi,
>
> Living in Canada, and being a bilingual country, I have data I am
> processing which includes dates in both English and French.
>
> I was wondering if there was a way to use the strtotime() function
> when the months are in one or the other of the above two languages?
Sure, strftime() is locale-sensitive. Set the locale().
--
Per Jessen, Zürich (4.4°C)
--- End Message ---
--- Begin Message ---
On 05/02/11 13:23, Per Jessen wrote:
Alexis wrote:
Hi,
Living in Canada, and being a bilingual country, I have data I am
processing which includes dates in both English and French.
I was wondering if there was a way to use the strtotime() function
when the months are in one or the other of the above two languages?
Sure, strftime() is locale-sensitive. Set the locale().
Thanks
But what if the locale is in two possible languages, all mixed together?
I suppose I could set it to one, check if the output is valid, if not,
set it to the other.
Alexis
--- End Message ---
--- Begin Message ---
Either form should be day/month/year/time, or somewhere in that order.
>From what i know, it shouldn't change much no matter the language.
--- End Message ---
--- Begin Message ---
Just check for the initial difference you see in the formats of either.
--- End Message ---