RE: [PHP] Best practice question regarding set_include_path()

2012-05-10 Thread admin


-Original Message-
From: Al [mailto:n...@ridersite.org] 
Sent: Thursday, May 10, 2012 11:44 AM
To: php-general@lists.php.net
Subject: [PHP] Best practice question regarding set_include_path()

For my applications, I've been using includes and other file addressing by
using the doc root as the base dir.   e.g.
require_once $_SERVER['DOCUMENT_ROOT'] .
'/miniRegDB/includes/miniRegDBconfig.php';

Recently, I ran into a problem with a new installation on a shared host
where the doc root was assigned in an unusual manner. I rather not require
setting a custom base dir [instead of $_SERVER['DOCUMENT_ROOT']'] for my
applications.

So, I was wondering if it would be good practice to use the
set_include_path() and add the base dir for my applications.  I've used this
for dealing with Pear function files on shared servers and had no problems.

Need some guidance regarding this subject.

Thanks 

--

I use define to set the application path
define('BASE_PATH','C:\\inetpub\\vhosts\\yourwebsite.com\\httpdocs\\');

Example:
require_once (BASE_PATH. '/miniRegDB/includes/miniRegDBconfig.php');


works great for JQuery paths

script
$(document).ready(function() {
$('#dareport').html('img src=?php echo BASE_URL;?images/loading.gif
/');
});
/script

To me it is much better than set_include_path() but works in the same
premise



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



Re: [PHP] Best practice question regarding set_include_path()

2012-05-10 Thread tamouse mailing lists
On Thu, May 10, 2012 at 1:50 PM, admin ad...@buskirkgraphics.com wrote:


 -Original Message-
 From: Al [mailto:n...@ridersite.org]
 Sent: Thursday, May 10, 2012 11:44 AM
 To: php-general@lists.php.net
 Subject: [PHP] Best practice question regarding set_include_path()

 For my applications, I've been using includes and other file addressing by
 using the doc root as the base dir.   e.g.
 require_once $_SERVER['DOCUMENT_ROOT'] .
 '/miniRegDB/includes/miniRegDBconfig.php';

 Recently, I ran into a problem with a new installation on a shared host
 where the doc root was assigned in an unusual manner. I rather not require
 setting a custom base dir [instead of $_SERVER['DOCUMENT_ROOT']'] for my
 applications.

 So, I was wondering if it would be good practice to use the
 set_include_path() and add the base dir for my applications.  I've used this
 for dealing with Pear function files on shared servers and had no problems.

 Need some guidance regarding this subject.

 Thanks

 --

 I use define to set the application path
 define('BASE_PATH','C:\\inetpub\\vhosts\\yourwebsite.com\\httpdocs\\');

 Example:
 require_once (BASE_PATH. '/miniRegDB/includes/miniRegDBconfig.php');


 works great for JQuery paths

 script
 $(document).ready(function() {
 $('#dareport').html('img src=?php echo BASE_URL;?images/loading.gif
 /');
 });
 /script

 To me it is much better than set_include_path() but works in the same
 premise



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


I tend to use a slightly more portable version:

define('APP_ROOT',dirname(__FILE__));

in a configuration file. (If the configuration file happens to be at a
different depth than the main application file(s), I stack on more
dirname's to get back to the application root.)

Similarly, I usually need an application URL path. This can be
trickier, depending on how you structure your application. This
generally works for the applications I develop:

define('APP_URL_BASE','http://'.$_SERVER['HOST_NAME'].dirname($_SERVER['SCRIPT_NAME']));

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



RE: [PHP] Best practice for if (!$stmt-execute())

2010-10-25 Thread Tommy Pham
 -Original Message-
 From: Rico Secada [mailto:coolz...@it.dk]
 Sent: Sunday, October 24, 2010 9:06 PM
 To: php-general@lists.php.net
 Subject: [PHP] Best practice for if (!$stmt-execute())
 
 Hi.
 
 I have been doing like this:
 
 if (!$stmt-execute()) {
   return false;
 } else {
 
 ... some code
 
   return true;
 OR
   return $foo; // Some int, string, whatever.
 
 }
 
 I am thinking about changing the return false with a:
 
 if (!$stmt-execute()) {
   die(DB_ERROR);
 
 This way making sure that every single db execute gets a valid check and
at
 the same time return some kind of valuable db error to the user and end
the
 script.
 
 How do you deal with db execution checks?
 
 Thanks in advance!
 
 Best regards.
 
 Rico.
 

Rico,

Shouldn't you consider this as what happens, while in production, should
the script fails?, whether its DB related or not.  In that case, how would
you want to handle the error?   Do you, or the system admin, want to be
notified one way or another of the failure?  Do want to implement a backup
in case that failure happens as an 'automatic recovery' mechanism?  As a
system/network admin, I go by 3 guidelines:
1) Prevent failure as much as I can (either system hardware, software
applications, hacks/exploits/vulnerabilities, etc.).
2) In the event that 1 fails, what's the recovery process?  How fast can I
recover from it?
3) If 2 fails, then there's something wrong with the whole process, which I
need to expand my knowledge  skillset.

In my past experiences, I haven't yet got to stage 2 because there
precautions you can take to detect when a failure is about to happen so that
stage 2 will never happens.  What you need to consider is how important is
this?  Is it mission critical?

Regards,
Tommy


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



Re: [PHP] Best practice for if (!$stmt-execute())

2010-10-25 Thread Rico Secada
On Mon, 25 Oct 2010 00:26:23 -0700
Tommy Pham tommy...@gmail.com wrote:

  -Original Message-
  From: Rico Secada [mailto:coolz...@it.dk]
  Sent: Sunday, October 24, 2010 9:06 PM
  To: php-general@lists.php.net
  Subject: [PHP] Best practice for if (!$stmt-execute())
  
  Hi.
  
  I have been doing like this:
  
  if (!$stmt-execute()) {
  return false;
  } else {
  
  ... some code
  
  return true;
  OR
  return $foo; // Some int, string, whatever.
  
  }
  
  I am thinking about changing the return false with a:
  
  if (!$stmt-execute()) {
  die(DB_ERROR);
  
  This way making sure that every single db execute gets a valid
  check and
 at
  the same time return some kind of valuable db error to the user and
  end
 the
  script.
  
  How do you deal with db execution checks?
  
  Thanks in advance!
  
  Best regards.
  
  Rico.
  
 
 Rico,
 
 Shouldn't you consider this as what happens, while in production,
 should the script fails?, whether its DB related or not.  In that
 case, how would you want to handle the error?   Do you, or the system
 admin, want to be notified one way or another of the failure?  Do
 want to implement a backup in case that failure happens as an
 'automatic recovery' mechanism?  As a system/network admin, I go by 3
 guidelines:
 1) Prevent failure as much as I can (either system hardware, software
 applications, hacks/exploits/vulnerabilities, etc.).
 2) In the event that 1 fails, what's the recovery process?  How fast
 can I recover from it?
 3) If 2 fails, then there's something wrong with the whole process,
 which I need to expand my knowledge  skillset.
 
 In my past experiences, I haven't yet got to stage 2 because there
 precautions you can take to detect when a failure is about to happen
 so that stage 2 will never happens.  What you need to consider is how
 important is this?  Is it mission critical?
 
 Regards,
 Tommy

Thank you for some very important thoughts! Creating an extended error
handling function seems appropriate.

Regards,
Rico 

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



Re: [PHP] Best practice for if (!$stmt-execute())

2010-10-25 Thread Paul M Foster
On Mon, Oct 25, 2010 at 06:06:24AM +0200, Rico Secada wrote:

 Hi.
 
 I have been doing like this:
 
 if (!$stmt-execute()) {
   return false;
 } else {
 
 ... some code
 
   return true;
 OR
   return $foo; // Some int, string, whatever.
 
 }
 
 I am thinking about changing the return false with a:
 
 if (!$stmt-execute()) {
   die(DB_ERROR);
 
 This way making sure that every single db execute gets a valid check
 and at the same time return some kind of valuable db error to the user
 and end the script.
 
 How do you deal with db execution checks?
 
 Thanks in advance!
 
 Best regards.
 
 Rico.

First, there are only a few ways a *true* error can occur with my
database. 1) Bad syntax from the programmer (me). 2) Bad input from the
user (which should never happen). 3) A catastrophic failure on the
database back end.

In all three cases, there is no recovery unless the programmer (me) digs
into the problem. Therefore, I have an error routine used for
everything, which dies and sends the programmer an email with a trace in
the case of a catastrophic error, like the above. And I have a database
wrapper class which checks for errors like this and fires the error
handler if the error is this bad. That means the script will abort and
the programmer will get an email.

Bear in mind, an error is *never* that a query returned no data or
data the user might consider bad.

Paul

-- 
Paul M. Foster

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



Re: [PHP] Best practice for if (!$stmt-execute())

2010-10-25 Thread Rico Secada
On Mon, 25 Oct 2010 22:56:37 -0400
Paul M Foster pa...@quillandmouse.com wrote:

 Bear in mind, an error is *never* that a query returned no data or
 data the user might consider bad.

This is an important point. When is an error an actual error? When is
it something that *needs* to be logged and mailed?
 
 Paul
 
 -- 
 Paul M. Foster
 
 -- 
 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



Re: [PHP] Best practice for if (!$stmt-execute())

2010-10-25 Thread Paul M Foster
On Tue, Oct 26, 2010 at 06:27:33AM +0200, Rico Secada wrote:

 On Mon, 25 Oct 2010 22:56:37 -0400
 Paul M Foster pa...@quillandmouse.com wrote:
 
  Bear in mind, an error is *never* that a query returned no data or
  data the user might consider bad.
 
 This is an important point. When is an error an actual error? When is
 it something that *needs* to be logged and mailed?

When it's a programmer/DBA error and cannot be recovered from. For
example, the statement:

SELECT * WHERE custno = 'BOBSMITH';

contains a syntax error (no table reference). That should generate a
fatal error, because no such statement should ever be fired at the DBMS.
The programmer should ensure his statements don't contain errors like
that. And if they do, there's no way to fix it from a user's
perspective.

There are any of a number of other PHP errors which will generate
error level messages which should lead to fatal errors. The code
should now allow such errors.

And no user input should create such errors. The programmer has to
filter the user's input so that whatever he enters, it doesn't cause PHP
or the DBMS to error out that way.

These are just definitions of fatal errors from my perspective.
Opinions may vary.

Paul

-- 
Paul M. Foster

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



Re: [PHP] Best Practice to Create Dynamic URL's- With Username

2009-09-21 Thread Tommy Pham
- Original Message 
 From: Gaurav Kumar kumargauravjuke...@gmail.com
 To: php-general@lists.php.net
 Sent: Monday, September 21, 2009 12:54:30 AM
 Subject: [PHP] Best Practice to Create Dynamic URL's- With Username
 
 Hi All,
 
 I am creating a social networking website. I want that every user should
 have there own profile page with a static URL like-
 
 http://www.abcnetwork/user/username
 
 Where username will be dynamic userid or something else.
 
 This is something very similar to www.youtube.com/user/kumargauravmail (this
 is my profile page).
 
 So what should be the best practice to create such DYNAMIC URL's OR what
 kind of methodology youtube is following?
 
 Thanks in Advance.
 
 Gaurav Kumar
 OSWebstudio.com

Assuming the 'username' is from DB, look into URL rewrite. Thus, client see this

http://www.abcnetwork/user/username

which translates into this  (or something similar) to PHP

http://www.abcnetwork/userProfile.php?user=username

Of course, you'll need to handle the 404 just in case ;)

Regards,
Tommy


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



Re: [PHP] Best Practice to Create Dynamic URL's- With Username

2009-09-21 Thread Ashley Sheridan
On Mon, 2009-09-21 at 13:24 +0530, Gaurav Kumar wrote:
 Hi All,
 
 I am creating a social networking website. I want that every user should
 have there own profile page with a static URL like-
 
 http://www.abcnetwork/user/username
 
 Where username will be dynamic userid or something else.
 
 This is something very similar to www.youtube.com/user/kumargauravmail (this
 is my profile page).
 
 So what should be the best practice to create such DYNAMIC URL's OR what
 kind of methodology youtube is following?
 
 Thanks in Advance.
 
 Gaurav Kumar
 OSWebstudio.com

If you're working on an Apache server, your best bet is to look at
mod_rewrite. You can write a simple rule to match against these sorts of
URL formats, so that to your visitors it appears as if the actual path
exists, but internally it can get translated to something like
http://www.abcnetwork.com/profile.php?id=username 

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




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



Re: [PHP] Best Practice to Create Dynamic URL's- With Username

2009-09-21 Thread Richard Heyes
Hi,

 ...

As has been suggested you could use mod_rewrite, but you don't have to
if your needs are simple (or maybe you don't have it). You could also
use the ForceType directive. Eg on my website the URLs are like this:

http://www.phpguru.org/article/20-years-of-php

Where article is actually a PHP file without the .php extension.
It's forced to run as a PHP file using this:

Files article 
ForceType application/x-httpd-php
/Files

And you will find the URL in $_SERVER somewhere.

-- 
Richard Heyes
HTML5 graphing: RGraph - www.rgraph.net (updated 5th September)
Lots of PHP and Javascript code - http://www.phpguru.org

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



Re: [PHP] Best Practice to Create Dynamic URL's- With Username

2009-09-21 Thread Gaurav Kumar
A Big Thanks to all of you.

Question I was Asked by Andrea- mod_reqrite or .htaccess is the answer, but
I wonder why you choose /user/username rather than just /username a la
twitter.

I will be using many other aspects of my users something like
/projects/username/; /gallery/username/.

OK Ashley, Tommy and Ralph-

100% correct that mod_rewrite will be used.

I am a bit sticky that my URL will be-
http://www.abcnetwork/user/*Ashley*http://www.abcnetwork/user/username.

So will I get $_GET[user] with value as *Ashley* or *Tommy* in my
script?

http://www.abcnetwork/userProfile.php?user=usernameSo what exactly will be
the .htaccess rule for above?


Thanks,

Gaurav Kumar
OSWebstudio.Com



On Mon, Sep 21, 2009 at 1:26 PM, Ashley Sheridan
a...@ashleysheridan.co.ukwrote:

 On Mon, 2009-09-21 at 13:24 +0530, Gaurav Kumar wrote:
  Hi All,
 
  I am creating a social networking website. I want that every user should
  have there own profile page with a static URL like-
 
  http://www.abcnetwork/user/username
 
  Where username will be dynamic userid or something else.
 
  This is something very similar to www.youtube.com/user/kumargauravmail(this
  is my profile page).
 
  So what should be the best practice to create such DYNAMIC URL's OR what
  kind of methodology youtube is following?
 
  Thanks in Advance.
 
  Gaurav Kumar
  OSWebstudio.com

 If you're working on an Apache server, your best bet is to look at
 mod_rewrite. You can write a simple rule to match against these sorts of
 URL formats, so that to your visitors it appears as if the actual path
 exists, but internally it can get translated to something like
 http://www.abcnetwork.com/profile.php?id=username

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






RE: [PHP] Best Practice to Create Dynamic URL's- With Username

2009-09-21 Thread Andrea Giammarchi



 
 Question I was Asked by Andrea- mod_reqrite or .htaccess is the answer, but
 I wonder why you choose /user/username rather than just /username a la
 twitter.
 
 I will be using many other aspects of my users something like
 /projects/username/; /gallery/username/.

well, it does not matter if this service is user based.

/username/ #as user home page

/username/projects/ #as user projects

/username/gallery/ #as user gallery

/username/etc ...

it's just a silly point but from user home page you isntantly know if user 
exists and you instantly know subsections

In your way you assume that there is a gallery for that user while he could 
have created only projects, without galleries.
So one search failed, while to go in the user page I need to digit /user/ 
before, not a big deal but we are in tinyurl and bit.ly era

Google Code put simply a /p/ as prefix plus the project name plus subsection


/p/myprojname/

/p/myprojname/wiki

since you are starting now, maybe you could consider this semantic alternative, 
if it suits your requirements.

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

_
More than messages–check out the rest of the Windows Live™.
http://www.microsoft.com/windows/windowslive/

Re: [PHP] Best Practice to Create Dynamic URL's- With Username

2009-09-21 Thread Gaurav Kumar
I totally agree with this architecture.

You are correct, I am just in the starting phase of the project and in fact
still need to define the architecture in detail.

Now the question I asked in my last reply is still to be answered?

Gaurav Kumar
OSWebstudio.Com

On Mon, Sep 21, 2009 at 3:06 PM, Andrea Giammarchi an_...@hotmail.comwrote:



 
  Question I was Asked by Andrea- mod_reqrite or .htaccess is the answer,
 but
  I wonder why you choose /user/username rather than just /username a la
  twitter.
 
  I will be using many other aspects of my users something like
  /projects/username/; /gallery/username/.

 well, it does not matter if this service is user based.

 /username/ #as user home page
 /username/projects/ #as user projects
 /username/gallery/ #as user gallery
 /username/etc ...

 it's just a silly point but from user home page you isntantly know if user
 exists and you instantly know subsections

 In your way you assume that there is a gallery for that user while he could
 have created only projects, without galleries.
 So one search failed, while to go in the user page I need to digit /user/
 before, not a big deal but we are in tinyurl and bit.ly era

 Google Code put simply a /p/ as prefix plus the project name plus
 subsection

 /p/myprojname/
 /p/myprojname/wiki

 since you are starting now, maybe you could consider this semantic
 alternative, if it suits your requirements.

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

 --
 check out the rest of the Windows Live™. More than mail–Windows Live™ goes
 way beyond your inbox. More than 
 messageshttp://www.microsoft.com/windows/windowslive/



Re: [PHP] Best Practice to Create Dynamic URL's- With Username

2009-09-21 Thread Ashley Sheridan
On Mon, 2009-09-21 at 15:20 +0530, Gaurav Kumar wrote:
 I totally agree with this architecture. 
 
 You are correct, I am just in the starting phase of the project and in
 fact still need to define the architecture in detail.
 
 Now the question I asked in my last reply is still to be answered?
 
 Gaurav Kumar
 OSWebstudio.Com
 
 On Mon, Sep 21, 2009 at 3:06 PM, Andrea Giammarchi
 an_...@hotmail.com wrote:
 
 
  
  Question I was Asked by Andrea- mod_reqrite or .htaccess is
 the answer, but
  I wonder why you choose /user/username rather than
 just /username a la
  twitter.
  
  I will be using many other aspects of my users something
 like
  /projects/username/; /gallery/username/.
 
 
 well, it does not matter if this service is user based.
 
 /username/ #as user home page
 /username/projects/ #as user projects
 /username/gallery/ #as user gallery
 /username/etc ...
 
 it's just a silly point but from user home page you isntantly
 know if user exists and you instantly know subsections
 
 In your way you assume that there is a gallery for that user
 while he could have created only projects, without galleries.
 So one search failed, while to go in the user page I need to
 digit /user/ before, not a big deal but we are in tinyurl and
 bit.ly era
 
 Google Code put simply a /p/ as prefix plus the project name
 plus subsection
 
 /p/myprojname/
 /p/myprojname/wiki
 
 since you are starting now, maybe you could consider this
 semantic alternative, if it suits your requirements.
 
 Regards
 
   Thanks,
   Ash
   http://www.ashleysheridan.co.uk
  
  
  
  
 
 
 
 __
 check out the rest of the Windows Live™. More than mail–
 Windows Live™ goes way beyond your inbox. More than messages
 
For help with the mod_rewrite, a Google search never goes amiss, first
result I found for 'mod_rewrite example' is
http://www.workingwith.me.uk/articles/scripting/mod_rewrite . I looked
at it quickly and it does cover what you need.

As for what you get as $_GET parameters, that's entirely up to you, and
as you will see from the above link, it's fairly simple to mess about
with.


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




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



Re: [PHP] Best Practice to Create Dynamic URL's- With Username

2009-09-21 Thread Gaurav Kumar
Thanks Ashley and all the folks out there...

On Mon, Sep 21, 2009 at 3:25 PM, Ashley Sheridan
a...@ashleysheridan.co.ukwrote:

 On Mon, 2009-09-21 at 15:20 +0530, Gaurav Kumar wrote:
  I totally agree with this architecture.
 
  You are correct, I am just in the starting phase of the project and in
  fact still need to define the architecture in detail.
 
  Now the question I asked in my last reply is still to be answered?
 
  Gaurav Kumar
  OSWebstudio.Com
 
  On Mon, Sep 21, 2009 at 3:06 PM, Andrea Giammarchi
  an_...@hotmail.com wrote:
 
 
  
   Question I was Asked by Andrea- mod_reqrite or .htaccess is
  the answer, but
   I wonder why you choose /user/username rather than
  just /username a la
   twitter.
  
   I will be using many other aspects of my users something
  like
   /projects/username/; /gallery/username/.
 
 
  well, it does not matter if this service is user based.
 
  /username/ #as user home page
  /username/projects/ #as user projects
  /username/gallery/ #as user gallery
  /username/etc ...
 
  it's just a silly point but from user home page you isntantly
  know if user exists and you instantly know subsections
 
  In your way you assume that there is a gallery for that user
  while he could have created only projects, without galleries.
  So one search failed, while to go in the user page I need to
  digit /user/ before, not a big deal but we are in tinyurl and
  bit.ly era
 
  Google Code put simply a /p/ as prefix plus the project name
  plus subsection
 
  /p/myprojname/
  /p/myprojname/wiki
 
  since you are starting now, maybe you could consider this
  semantic alternative, if it suits your requirements.
 
  Regards
 
Thanks,
Ash
http://www.ashleysheridan.co.uk
   
   
   
   
 
 
 
  __
  check out the rest of the Windows Live™. More than mail–
  Windows Live™ goes way beyond your inbox. More than messages
 
 For help with the mod_rewrite, a Google search never goes amiss, first
 result I found for 'mod_rewrite example' is
 http://www.workingwith.me.uk/articles/scripting/mod_rewrite . I looked
 at it quickly and it does cover what you need.

 As for what you get as $_GET parameters, that's entirely up to you, and
 as you will see from the above link, it's fairly simple to mess about
 with.


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






Re: [PHP] Best Practice to Create Dynamic URL's- With Username

2009-09-21 Thread Tommy Pham
- Original Message 
 From: Ashley Sheridan a...@ashleysheridan.co.uk
 To: Gaurav Kumar kumargauravjuke...@gmail.com
 Cc: Andrea Giammarchi an_...@hotmail.com; php-general@lists.php.net
 Sent: Monday, September 21, 2009 2:55:20 AM
 Subject: Re: [PHP] Best Practice to Create Dynamic URL's- With Username
 
 On Mon, 2009-09-21 at 15:20 +0530, Gaurav Kumar wrote:
  I totally agree with this architecture. 
  
  You are correct, I am just in the starting phase of the project and in
  fact still need to define the architecture in detail.
  
  Now the question I asked in my last reply is still to be answered?
  
  Gaurav Kumar
  OSWebstudio.Com
  
  On Mon, Sep 21, 2009 at 3:06 PM, Andrea Giammarchi
  wrote:
 
 
   
   Question I was Asked by Andrea- mod_reqrite or .htaccess is
  the answer, but
   I wonder why you choose /user/username rather than
  just /username a la
   twitter.
   
   I will be using many other aspects of my users something
  like
   /projects/username/; /gallery/username/.
 
 
  well, it does not matter if this service is user based.
 
  /username/ #as user home page
  /username/projects/ #as user projects
  /username/gallery/ #as user gallery
  /username/etc ...
 
  it's just a silly point but from user home page you isntantly
  know if user exists and you instantly know subsections
 
  In your way you assume that there is a gallery for that user
  while he could have created only projects, without galleries.
  So one search failed, while to go in the user page I need to
  digit /user/ before, not a big deal but we are in tinyurl and
 bit.ly era
 
  Google Code put simply a /p/ as prefix plus the project name
  plus subsection
 
  /p/myprojname/
  /p/myprojname/wiki
 
  since you are starting now, maybe you could consider this
  semantic alternative, if it suits your requirements.
 
  Regards
 
Thanks,
Ash
http://www.ashleysheridan.co.uk
   
   
   
   
 
 
 
  __
  check out the rest of the Windows Live™. More than mail–
  Windows Live™ goes way beyond your inbox. More than messages
  
 For help with the mod_rewrite, a Google search never goes amiss, first
 result I found for 'mod_rewrite example' is
 http://www.workingwith.me.uk/articles/scripting/mod_rewrite . I looked
 at it quickly and it does cover what you need.
 
 As for what you get as $_GET parameters, that's entirely up to you, and
 as you will see from the above link, it's fairly simple to mess about
 with.
 
 
 Thanks,
 Ash
 http://www.ashleysheridan.co.uk
 
 

Ash,

What's the IP that the link you gave resolve to?  I'm getting timed out for the 
DNS lookup on my end ... 

Thanks,
Tommy

 
 
 --
 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



Re: [PHP] Best Practice to Create Dynamic URL's- With Username

2009-09-21 Thread Ashley Sheridan
On Mon, 2009-09-21 at 03:42 -0700, Tommy Pham wrote:
 - Original Message 
  From: Ashley Sheridan a...@ashleysheridan.co.uk
  To: Gaurav Kumar kumargauravjuke...@gmail.com
  Cc: Andrea Giammarchi an_...@hotmail.com; php-general@lists.php.net
  Sent: Monday, September 21, 2009 2:55:20 AM
  Subject: Re: [PHP] Best Practice to Create Dynamic URL's- With Username
  
  On Mon, 2009-09-21 at 15:20 +0530, Gaurav Kumar wrote:
   I totally agree with this architecture. 
   
   You are correct, I am just in the starting phase of the project and in
   fact still need to define the architecture in detail.
   
   Now the question I asked in my last reply is still to be answered?
   
   Gaurav Kumar
   OSWebstudio.Com
   
   On Mon, Sep 21, 2009 at 3:06 PM, Andrea Giammarchi
   wrote:
  
  

Question I was Asked by Andrea- mod_reqrite or .htaccess is
   the answer, but
I wonder why you choose /user/username rather than
   just /username a la
twitter.

I will be using many other aspects of my users something
   like
/projects/username/; /gallery/username/.
  
  
   well, it does not matter if this service is user based.
  
   /username/ #as user home page
   /username/projects/ #as user projects
   /username/gallery/ #as user gallery
   /username/etc ...
  
   it's just a silly point but from user home page you isntantly
   know if user exists and you instantly know subsections
  
   In your way you assume that there is a gallery for that user
   while he could have created only projects, without galleries.
   So one search failed, while to go in the user page I need to
   digit /user/ before, not a big deal but we are in tinyurl and
  bit.ly era
  
   Google Code put simply a /p/ as prefix plus the project name
   plus subsection
  
   /p/myprojname/
   /p/myprojname/wiki
  
   since you are starting now, maybe you could consider this
   semantic alternative, if it suits your requirements.
  
   Regards
  
 Thanks,
 Ash
 http://www.ashleysheridan.co.uk




  
  
  
   __
   check out the rest of the Windows Live™. More than mail–
   Windows Live™ goes way beyond your inbox. More than messages
   
  For help with the mod_rewrite, a Google search never goes amiss, first
  result I found for 'mod_rewrite example' is
  http://www.workingwith.me.uk/articles/scripting/mod_rewrite . I looked
  at it quickly and it does cover what you need.
  
  As for what you get as $_GET parameters, that's entirely up to you, and
  as you will see from the above link, it's fairly simple to mess about
  with.
  
  
  Thanks,
  Ash
  http://www.ashleysheridan.co.uk
  
  
 
 Ash,
 
 What's the IP that the link you gave resolve to?  I'm getting timed out for 
 the DNS lookup on my end ... 
 
 Thanks,
 Tommy
 
  
  
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 

I get 80.82.121.153 for it. You might have an issue with your DNS
server. There are a lot of freely available alternative DNS servers
about the world that you can use instead. I had to do that myself one
time, when the DNS server issued by my ISP was misbehaving and I was
getting lots of timeouts just like you are getting.

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




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



Re: [PHP] best practice wrt multi-lingual websites, gettext() etc.

2009-01-27 Thread Per Jessen
Bastien Koert wrote:

 No, as all of our users have to authorized to use the app, we store
 the desired language in a field in the user record. However, we also
 supply functionality via a drop down to allow the user to change the
 language if desired.

Okay, that's very similar to my approach.  For first-time users (of
which I will have a lot), the language is set by their browser's
language setting.  Most users won't be changing it.

 I agree its difficult to separate the language and the code, but if
 you create xslt / html files for each language then its a much simpler
 matter, and far less resouce intensive, to direct the user to that
 page in their desired language. 

I leave that to Apache and the 'prefer-language' environment variable -
I guess my main issue is to do with e.g. error-messages from PHP code
(please complete this field correctly etc) and from javascript ditto. 

I guess for error-messages, it's back to gettext(), which does make some
sense. 

 Again, you and just use PHP and handle the labels and option (drop
 downs, radios etc) variables in real time  but I never see the point
 in doing the same thing over and over again when its much cleaner (if
 more management intensive)  to direct the user to a static resource
 and pass in an XML string with the data in it.

Totally agree. 

 At work, we don't use gettext() since :
 a) its an classic ASP shop (  :-(  ), therefore no Linux and no PHP

Ah. :-)

 b) the db current doesn't support multi-byte charsets
 

The gettext db doesn't support UTF8??? Uh oh, that's a show-stopper.


/Per Jessen, Zürich


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



Re: [PHP] best practice wrt multi-lingual websites, gettext() etc.

2009-01-27 Thread Jan Kaštánek
Per Jessen:

  The gettext db doesn't support UTF8??? Uh oh, that's a show-stopper.

It supports. We use it. But only in MsgStr (translation), not in MsgId
(original strings).

-- 
toby

http://toby.cz/

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



Re: [PHP] best practice wrt multi-lingual websites, gettext() etc.

2009-01-27 Thread Per Jessen
Jan Kaštánek wrote:

 Per Jessen:

  The gettext db doesn't support UTF8??? Uh oh, that's a show-stopper.
 
 It supports. We use it. But only in MsgStr (translation), not in MsgId
 (original strings).
 

Yeah, I found out too.  (from the GNU gettext docu).


/Per Jessen, Zürich


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



Re: [PHP] best practice wrt multi-lingual websites, gettext() etc.

2009-01-27 Thread Phpster

Sorry guys,

I meant that the current application database is not configured for  
utf-8


Bastien

Sent from my iPod

On Jan 27, 2009, at 6:04, Per Jessen p...@computer.org wrote:


Jan Kaštánek wrote:


Per Jessen:


The gettext db doesn't support UTF8??? Uh oh, that's a show-stopper.


It supports. We use it. But only in MsgStr (translation), not in  
MsgId

(original strings).



Yeah, I found out too.  (from the GNU gettext docu).


/Per Jessen, Zürich


--
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



Re: [PHP] best practice wrt multi-lingual websites, gettext() etc.

2009-01-26 Thread Per Jessen
Phpster wrote:

 Dunno if it's a best practice, but I store all the translations in the
 db for easy manipulation and extraction to a file for others to
 translate. That obviously involves both import and export utilities.

Hi Bastien

interesting - does this mean you're also coding for language-awareness
yourself?  I mean, you must have your own gettext() functionality?

 A number of pup apps take the approach of storing the label
 translations in variables inside language folders ( phpmyadmin has
 this ). That is also not a bad approach but is slightly slower and I
 can't help but feeling that serving up a static page created by code
 is a better solution. 

That's part of what we're thinking of doing, but it's difficult to
separate the language and code completely.  Which is where gettext()
comes in. 

Does anyone on this list use gettext() ?


/Per Jessen, Zürich


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



Re: [PHP] best practice wrt multi-lingual websites, gettext() etc.

2009-01-26 Thread Bastien Koert
On Mon, Jan 26, 2009 at 12:21 PM, Per Jessen p...@computer.org wrote:

 Phpster wrote:

  Dunno if it's a best practice, but I store all the translations in the
  db for easy manipulation and extraction to a file for others to
  translate. That obviously involves both import and export utilities.

 Hi Bastien

 interesting - does this mean you're also coding for language-awareness
 yourself?  I mean, you must have your own gettext() functionality?

  A number of pup apps take the approach of storing the label
  translations in variables inside language folders ( phpmyadmin has
  this ). That is also not a bad approach but is slightly slower and I
  can't help but feeling that serving up a static page created by code
  is a better solution.

 That's part of what we're thinking of doing, but it's difficult to
 separate the language and code completely.  Which is where gettext()
 comes in.

 Does anyone on this list use gettext() ?


 /Per Jessen, Zürich


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


No, as all of our users have to authorized to use the app, we store the
desired language in a field in the user record. However, we also supply
functionality via a drop down to allow the user to change the language if
desired.

I agree its difficult to separate the language and the code, but if you
create xslt / html files for each language then its a much simpler matter,
and far less resouce intensive, to direct the user to that page in their
desired language. Again, you and just use PHP and handle the labels and
option (drop downs, radios etc) variables in real time  but I never see the
point in doing the same thing over and over again when its much cleaner (if
more management intensive)  to direct the user to a static resource and pass
in an XML string with the data in it.

At work, we don't use gettext() since :
a) its an classic ASP shop (  :-(  ), therefore no Linux and no PHP
b) the db current doesn't support multi-byte charsets

My personal projects (or work on the side) are, of course, all php but so
far there has been no requirements for multi language support, though the
two projects that I am starting will both require it. Not sure if I will use
gettext(), I will research some more, but it will definitely support
multi-language and the db is unicode.


-- 

Bastien

Cat, the other other white meat


RE: [PHP] best practice wrt multi-lingual websites, gettext() etc.

2009-01-26 Thread Boyd, Todd M.
 -Original Message-
 From: Bastien Koert [mailto:phps...@gmail.com]
 Sent: Monday, January 26, 2009 12:23 PM
 To: Per Jessen
 Cc: php-general@lists.php.net
 Subject: Re: [PHP] best practice wrt multi-lingual websites, gettext()
 etc.

---8---
 
 At work, we don't use gettext() since :
 a) its an classic ASP shop (  :-(  ), therefore no Linux and no PHP
 b) the db current doesn't support multi-byte charsets

If database size (on disk, not spatially) isn't a concern, you might
consider encoding the multi-byte strings, storing them encoded, and then
decoding them when that language is requested. There will be overhead
involved in the codec operations, obviously, but you could help to curb
that with client- or server-side caching.

Just a thought. It might not be feasible for your situation at all...


// Todd

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



Re: [PHP] best practice wrt multi-lingual websites, gettext() etc.

2009-01-25 Thread Phpster
Dunno if it's a best practice, but I store all the translations in the  
db for easy manipulation and extraction to a file for others to  
translate. That obviously involves both import and export utilities.


At work we to the translation in real time thru a render page that  
combined  the data for the form as well as the labels and buttons.  
Personally I disagree with this approach and feel that caching out the  
page to either HTML or XML is quicker and cleaner. But that's just me.


A number of pup apps take the approach of storing the label  
translations in variables inside language folders ( phpmyadmin has  
this ). That is also not a bad approach but is slightly slower and I  
can't help but feeling that serving up a static page created by code  
is a better solution. It will be heavier on the management side, but  
my experience is that this mgmt activity drops off quickly after the  
first week or two of that form being in production.


Nth

Bastien

Sent from my iPod

On Jan 25, 2009, at 14:56, Per Jessen p...@computer.org wrote:


I am writing a small(ish) site which will eventually need to be
available in several different languages.  This needs to more or less
transparent to the user, so I am using Apaches content negotiation
features, which is working very well.
The issues arise once I start looking at PHP and Javascript code. I  
use

JS for client side input (pre-)validation and increased usability, and
error messages and such will obviously need to be language-sensitive.
The same goes for the PHP code.

With PHP, I've got gettext() for this sort of job, with javascript and
some DHTML, I don't seem to have many options.

One of my key concerns is - for the translation, I need to be able to
wrap everything up and ship it off to a translator, perhaps via elance
or similar.

Does anyone have any best practice suggestions or comments in general?


/Per Jessen, Zürich


--
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



Re: [PHP] best practice wrt multi-lingual websites, gettext() etc.

2009-01-25 Thread Richard Lynch
I can't help with the bits you are asking about, but I can give this
advice:

Don't rely solely on the Apache/browser content-negotiation, please.

This one time...

I was in Paris.

I was at an Internet Cafe.

I couldn't change browser settings.

Some sites that I knew were available in English showed me only
French, and no way to change it.

Despite my using a computer with a French keyboard, my French language
skills remained somewhere around the Bonjour. Parlez-vous Englias?
level.

-- 
Some people ask for gifts here.
I just want you to buy an Indie CD for yourself:
http://cdbaby.com/search/from/lynch



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



Re: [PHP] best practice wrt multi-lingual websites, gettext() etc.

2009-01-25 Thread Per Jessen
Richard Lynch wrote:

 I can't help with the bits you are asking about, but I can give this
 advice:
 
 Don't rely solely on the Apache/browser content-negotiation, please.
 

Don't worry, the site already has a user-override option. 


/Per Jessen, Zürich


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



RE: [PHP] Best practice to set up register_globals

2006-03-17 Thread Nicolas Verhaeghe
Would this be set in the apache.conf file or the php.ini file?

-Original Message-
From: Curt Zirzow [mailto:[EMAIL PROTECTED] 
Sent: Thursday, March 16, 2006 9:19 PM
To: php-general@lists.php.net
Subject: Re: [PHP] Best practice to set up register_globals


On Thu, Mar 16, 2006 at 08:46:07PM -0700, Nicolas Verhaeghe wrote:
 One of my clients has an os commerce install which requires 
 register_globals to be set to on, for some reason.
 
 It is set up to off in php.ini, as it should, but I'd like to know 
 what the best fashion would be for me to set it on locally for this 
 domain only.

Assuming you have apache as your webserver..

If you must set it, you can set it per any apache directive, like a
VirtualHost, Directory or the like or even a .htaccess (if enabled).


Curt.
-- 
cat .signature: No such file or directory

-- 
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



Re: [PHP] Best practice to set up register_globals

2006-03-17 Thread Chuck Anderson

Curt Zirzow wrote:


On Thu, Mar 16, 2006 at 08:46:07PM -0700, Nicolas Verhaeghe wrote:
 


One of my clients has an os commerce install which requires
register_globals to be set to on, for some reason.

It is set up to off in php.ini, as it should, but I'd like to know what
the best fashion would be for me to set it on locally for this domain
only.
   



Assuming you have apache as your webserver..

If you must set it, you can set it per any apache directive, like
a VirtualHost, Directory or the like or even a .htaccess (if
enabled).


Curt.
 

I'm not sure how they set it up, but at my web host I can put individual 
php.ini files in the directory the php script files are in.


That means that I can create a php.ini file and add 'register_globals 
on' in any directory where I need it.


Does anyone know how to configure that?

--
*
Chuck Anderson • Boulder, CO
http://www.CycleTourist.com
Integrity is obvious.
The lack of it is common.
*

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



RE: [PHP] Best practice to set up register_globals

2006-03-17 Thread Nicolas Verhaeghe



Curt Zirzow wrote:

On Thu, Mar 16, 2006 at 08:46:07PM -0700, Nicolas Verhaeghe wrote:
  

One of my clients has an os commerce install which requires 
register_globals to be set to on, for some reason.

It is set up to off in php.ini, as it should, but I'd like to know 
what the best fashion would be for me to set it on locally for this 
domain only.



Assuming you have apache as your webserver..

If you must set it, you can set it per any apache directive, like a 
VirtualHost, Directory or the like or even a .htaccess (if 
enabled).


Curt.
  

I'm not sure how they set it up, but at my web host I can put individual

php.ini files in the directory the php script files are in.

That means that I can create a php.ini file and add 'register_globals 
on' in any directory where I need it.

Does anyone know how to configure that?

-

Well that's what I always wondered. The php_info() shows the value as
set globally and locally. How do you override for a site or domain?

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



Re: [PHP] Best practice to set up register_globals

2006-03-17 Thread chris smith
On 3/18/06, Nicolas Verhaeghe [EMAIL PROTECTED] wrote:



 Curt Zirzow wrote:

 On Thu, Mar 16, 2006 at 08:46:07PM -0700, Nicolas Verhaeghe wrote:
 
 
 One of my clients has an os commerce install which requires
 register_globals to be set to on, for some reason.
 
 It is set up to off in php.ini, as it should, but I'd like to know
 what the best fashion would be for me to set it on locally for this
 domain only.
 
 
 
 Assuming you have apache as your webserver..
 
 If you must set it, you can set it per any apache directive, like a
 VirtualHost, Directory or the like or even a .htaccess (if
 enabled).
 
 
 Curt.
 
 
 I'm not sure how they set it up, but at my web host I can put individual

 php.ini files in the directory the php script files are in.

 That means that I can create a php.ini file and add 'register_globals
 on' in any directory where I need it.

 Does anyone know how to configure that?

 -

 Well that's what I always wondered. The php_info() shows the value as
 set globally and locally. How do you override for a site or domain?

With a htaccess file:

php_flag register_globals on

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] Best practice to set up register_globals locally?

2006-03-16 Thread Chris

Nicolas Verhaeghe wrote:

One of my clients has an os commerce install which requires
register_globals to be set to on, for some reason.

It is set up to off in php.ini, as it should, but I'd like to know what
the best fashion would be for me to set it on locally for this domain
only.


If you need to ask a new question please start a new thread - copy the 
email address and hit new instead of replying to an existing question. 
It makes it so much easier to follow.


See http://www.php.net/manual/en/ini.php#ini.list and 
http://www.php.net/manual/en/configuration.changes.php


Basically, in apache virtualhost or .htaccess file:

php_flag register_globals on


--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] Best practice to set up register_globals

2006-03-16 Thread Curt Zirzow
On Thu, Mar 16, 2006 at 08:46:07PM -0700, Nicolas Verhaeghe wrote:
 One of my clients has an os commerce install which requires
 register_globals to be set to on, for some reason.
 
 It is set up to off in php.ini, as it should, but I'd like to know what
 the best fashion would be for me to set it on locally for this domain
 only.

Assuming you have apache as your webserver..

If you must set it, you can set it per any apache directive, like
a VirtualHost, Directory or the like or even a .htaccess (if
enabled).


Curt.
-- 
cat .signature: No such file or directory

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



Re: [PHP] best practice question..

2004-12-09 Thread Richard Davey
Hello Guy,

Thursday, December 9, 2004, 12:34:03 PM, you wrote:

GB There's never a security issue here - i.e. i don't mind how many times /
GB who reads the message, but just want to make it hard to just guess keys
GB to read other messages (otherwise it would just be the db id)

GB This method works for me, but is it the *right* way?

There's no right or wrong way to do this - if it works for you, then
it works :)

The only thing I would strongly suggest is a check somewhere - if the
recipient has been sent an email already (perhaps within the last 30
days?) then you don't send them another one.

That way you're not open to being a spam bot.

Best regards,

Richard Davey
-- 
 http://www.launchcode.co.uk - PHP Development Services
 I am not young enough to know everything. - Oscar Wilde

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



Re: [PHP] best practice question..

2004-12-09 Thread Richard Lynch
Guy Bowden wrote:
 On this note - what is considered best practice in a - sent to friend
 type thing.

 i.e. User inputs their name + message + email + friends email into a
 html/flash form

 friend gets a link to read the message.

 currently I do this:

 1 collect form input
 2 create hash using the md5/uniqid method : $hash = md5(uniqid($key));
 3 input data to database table using the hash as the primary key value
 4 send email to friend with link containing the hash
 5 user clicks on link
 6 hash read in from the $_GET object
 7 hash used to select message details from DB and displayed to the user

 There's never a security issue here - i.e. i don't mind how many times /
 who reads the message, but just want to make it hard to just guess keys
 to read other messages (otherwise it would just be the db id)

 This method works for me, but is it the *right* way?

I would also:

Track the sender IP address, and only allow N sends per time period T.
Track the recipient email, and only allow M To:s per time period U.

The point being to stop spammers from using your system to spam the world,
or target specific victims.

Is $key the ID in the database?  You may want to consider adding in more
randomness with mt_rand() as the manual suggests on the uniqid page -- You
can still keep $key as part of the hash by doing:
md5(uniqid($key| . mt_rand(), true))

Certainly sending the md5/uniquid as the only thing exposed is about as
good as you can get for making sure that the other email URLs are
guessable -- You do run the risk that sooner or later your md5/uniquid
hash will collide with two emails on the same value.  Easy enough to
check the db and generate another hash if they do collide, so I'd add that
in if you don't have it.  Add a line after your md5(...) call and set
$hash = '42' for testing purpose, then comment it out to go back to
reality.

You could look into the larger bits and longer hashes that would be
better but I really don't think that's necessary, imho.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Best practice to re-write a tutorial website

2004-07-23 Thread EE
On Fri, 2004-07-23 at 00:06, Justin Patrin wrote:
 On Thu, 22 Jul 2004 23:48:54 +0300, EE [EMAIL PROTECTED] wrote:
  Dears,
  
  I am planing to rewrite my website. My site is tutorial-type site I
  wrote it, when I first learned php3, as an undergraduate research class.
  I think the code is sloppy as it is mixed with the HTML. I would like to
  rewrite the site utilizing the good things such OOP classes, template,
  etc. I would also like to separate my styles (CSS) from the HTML.

Do you recommend any any tutorial?
  
  I would like to have the following functions:
  
  1. Printer Friendly Version Capability
 
 You can use CSS and @media print to have *different* CSS for printing,
 right from the same site. You could also just have a different
 stylesheet that you include when the user wants to print. Or you could
 have multiple templates. Whatever floats your boat.
 
  2. Search-ability
 
 A CMS could possibly handle this, but may be a bit big for this. If
 you want search capabilities, I'd look into a local solution that
 indexes your site manually. I've had good luck with mnogosearch.
 
How about using MySQL fulltext?

  3. Search Engine Friendly
  
 
 https://www.reversefold.com/tikiwiki/tiki-index.php?page=PHPFAQs#id926344
 

I read the aritcle and it is good.

  Therefore, I have the following questions:
  
  1. What is the best way to store the tutorials. Should they be in a
  database or each in a separate HTML file.
 
 I'd go for database. But if you do that, you may want to look into
 some existing CMS software.

Do you recommend any? I'll appreciate if you point me to the right
track.

 
  
  2. How to implement the above three points?
  
  I know it is a broad question but you can help me on whatever you know?
  

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



Re: [PHP] Best practice to re-write a tutorial website

2004-07-23 Thread EE
On Fri, 2004-07-23 at 04:57, Justin French wrote:
 On 23/07/2004, at 6:48 AM, EE wrote:
 
  1. Printer Friendly Version Capability
 
 This can be achieved with media specific style sheets stylesheets -- no 
 need for separate templates.
 
Do you recommend any tutorial?

 
  2. Search-ability
 
 For the most part, this can be achieved with MySQL's fulltext search 
 capabilities.  You just need to wrap it all in a search GUI and results 
 page.
 
 
  3. Search Engine Friendly
 
 This relates back to #1.  If you restrict your use of HTML to only 
 semantic page elements (DIVs, H1-6s, Ps, etc), rather that filling it 
 with presentational mark-up (FONT, TABLE, etc) your pages will be 
 lighter, which will allow better indexing by search engines.  This is a 
 really quick overview of course, but standards-based web pages with all 
 presentational stuff moved to a CSS file will help SE's index your 
 content accurately, and it will be a pleasure to maintain.
 
How can I restrict my html to semantic elements? My tutorial has tables.
I don't mean styling table. I mean engineering data tables?

www.eeetc.bjaili.com/tutorial.php?num=7act=dig

how can I move presentational stuff to css file?

 This seems to be a common stylesheet set-up:
 link rel='stylesheet' media='all' href='css/basic.css' /
 link rel='stylesheet' media='print' href='css/print.css' /
 style type='text/css' media='screen'@import 
 url(css/advanced.css)/style
 
 But we're getting WAY off topic here.
 
 
  1. What is the best way to store the tutorials. Should they be in a
  database or each in a separate HTML file.
 
 Either is fine, but searching will be easier in a database -- 
 especially with MySQL's fulltext search built in.
 
 
 Search Google for specific help on any of the above, and you'll be set 
 :)
 
 
 ---
 Justin French
 http://indent.com.au
 
 
 

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



Re: [PHP] Best practice to re-write a tutorial website

2004-07-23 Thread Justin Patrin
On Fri, 23 Jul 2004 17:51:52 +0300, EE [EMAIL PROTECTED] wrote:
 On Fri, 2004-07-23 at 00:06, Justin Patrin wrote:
  On Thu, 22 Jul 2004 23:48:54 +0300, EE [EMAIL PROTECTED] wrote:
   Dears,
  
   I am planing to rewrite my website. My site is tutorial-type site I
   wrote it, when I first learned php3, as an undergraduate research class.
   I think the code is sloppy as it is mixed with the HTML. I would like to
   rewrite the site utilizing the good things such OOP classes, template,
   etc. I would also like to separate my styles (CSS) from the HTML.
 
 Do you recommend any any tutorial?
  
   I would like to have the following functions:
  
   1. Printer Friendly Version Capability
 
  You can use CSS and @media print to have *different* CSS for printing,
  right from the same site. You could also just have a different
  stylesheet that you include when the user wants to print. Or you could
  have multiple templates. Whatever floats your boat.
 
   2. Search-ability
 
  A CMS could possibly handle this, but may be a bit big for this. If
  you want search capabilities, I'd look into a local solution that
  indexes your site manually. I've had good luck with mnogosearch.
  
 How about using MySQL fulltext?
 
   3. Search Engine Friendly
  
 
  https://www.reversefold.com/tikiwiki/tiki-index.php?page=PHPFAQs#id926344
 
 
 I read the aritcle and it is good.
 
   Therefore, I have the following questions:
  
   1. What is the best way to store the tutorials. Should they be in a
   database or each in a separate HTML file.
 
  I'd go for database. But if you do that, you may want to look into
  some existing CMS software.
 
 Do you recommend any? I'll appreciate if you point me to the right
 track.
 

Wellthere's tikiwiki, which I'm using on my personal site right
now. It's real quick to get up and use. Then there's TYPO3, which I'm
using for work. It's very large and complex, but a very nice system.

 
  
   2. How to implement the above three points?
  
   I know it is a broad question but you can help me on whatever you know?
  
 

-- 
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder

paperCrane --Justin Patrin--

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



Re: [PHP] Best practice to re-write a tutorial website

2004-07-22 Thread Justin Patrin
On Thu, 22 Jul 2004 23:48:54 +0300, EE [EMAIL PROTECTED] wrote:
 Dears,
 
 I am planing to rewrite my website. My site is tutorial-type site I
 wrote it, when I first learned php3, as an undergraduate research class.
 I think the code is sloppy as it is mixed with the HTML. I would like to
 rewrite the site utilizing the good things such OOP classes, template,
 etc. I would also like to separate my styles (CSS) from the HTML.
 
 I would like to have the following functions:
 
 1. Printer Friendly Version Capability

You can use CSS and @media print to have *different* CSS for printing,
right from the same site. You could also just have a different
stylesheet that you include when the user wants to print. Or you could
have multiple templates. Whatever floats your boat.

 2. Search-ability

A CMS could possibly handle this, but may be a bit big for this. If
you want search capabilities, I'd look into a local solution that
indexes your site manually. I've had good luck with mnogosearch.

 3. Search Engine Friendly
 

https://www.reversefold.com/tikiwiki/tiki-index.php?page=PHPFAQs#id926344

 Therefore, I have the following questions:
 
 1. What is the best way to store the tutorials. Should they be in a
 database or each in a separate HTML file.

I'd go for database. But if you do that, you may want to look into
some existing CMS software.

 
 2. How to implement the above three points?
 
 I know it is a broad question but you can help me on whatever you know?
 

-- 
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder

paperCrane --Justin Patrin--

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



Re: [PHP] Best practice to re-write a tutorial website

2004-07-22 Thread Justin French
On 23/07/2004, at 6:48 AM, EE wrote:
1. Printer Friendly Version Capability
This can be achieved with media specific style sheets stylesheets -- no 
need for separate templates.


2. Search-ability
For the most part, this can be achieved with MySQL's fulltext search 
capabilities.  You just need to wrap it all in a search GUI and results 
page.


3. Search Engine Friendly
This relates back to #1.  If you restrict your use of HTML to only 
semantic page elements (DIVs, H1-6s, Ps, etc), rather that filling it 
with presentational mark-up (FONT, TABLE, etc) your pages will be 
lighter, which will allow better indexing by search engines.  This is a 
really quick overview of course, but standards-based web pages with all 
presentational stuff moved to a CSS file will help SE's index your 
content accurately, and it will be a pleasure to maintain.

This seems to be a common stylesheet set-up:
link rel='stylesheet' media='all' href='css/basic.css' /
link rel='stylesheet' media='print' href='css/print.css' /
style type='text/css' media='screen'@import 
url(css/advanced.css)/style

But we're getting WAY off topic here.

1. What is the best way to store the tutorials. Should they be in a
database or each in a separate HTML file.
Either is fine, but searching will be easier in a database -- 
especially with MySQL's fulltext search built in.

Search Google for specific help on any of the above, and you'll be set 
:)

---
Justin French
http://indent.com.au
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Best practice for creating mysql database structure for menus navigation

2004-04-19 Thread Marco Schuler
Hi

Am Mo, 2004-04-19 um 15.22 schrieb dr. zoidberg:
 Hello,
 
 What will be the best database structure for creating web site 
 navigation, menus with submenus (unlimited levels).

If you are fine with oop, than maybe 

http://pear.php.net/package/DB_NestedSet

would be worth a look. Renderers for different menu-types are also
included.

-- 
Regards
 Marco

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



Re: [PHP] Best Practice

2002-09-21 Thread Chris Shiflett

Ashley,

This is difficult to answer, as you are actually the best person to 
decide. Consider some of the following things:

1. How often do you anticipate people will use the printer-friendly link?
2. How much data do you anticipate, on average, to be contained in the 
results of these queries?
3. How much traffic do you anticipate?
4. How much memory does your Web server have?
5. Are you maintaining sessions anyway, or would this be the only thing 
to require them?

My (uneducated) guess would be that querying again is the best approach. 
You're basically talking about a separate request anyway, and the 
overhead of maintaining state might not be worth it, as you may end up 
with many of these result sets stored in the session, and the client may 
never use them.

Happy hacking.

Chris

Ashley M. Kirchner wrote:

I'm working on converting several static (price) pages on our site into dynamic 
pages, with the data stored in an MySQL database and PHP to pull the data out, with 
CSS to build the page and present it.  At the same time, I would also like to have a 
'printer friendly' link on each page that visitors can click on and get the same page 
re-rendered for easy printing.  What's the best way to get the data converted from 
one form to another?  Should I be querying the database again to get the same data to 
reformat?  Should I store the data in sessions and reformat based on the CSS?  I 
would think having to query twice for the same thing would be a degradation in 
performance, right?  So what's the best practice?



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




Re: [PHP] Best Practice

2002-09-21 Thread Paul Roberts

just use css to define separate styles for each media
e.g.
style type=text/css media=screen,projection
!--
// screen style
--
/style
style type=text/css media=print
!--
// print style
--
/style

then the print style will be applied when the user clicks print.

Paul Roberts
http://www.paul-roberts.com
[EMAIL PROTECTED]


- Original Message - 
From: Ashley M. Kirchner [EMAIL PROTECTED]
To: PHP-General List [EMAIL PROTECTED]
Sent: Saturday, September 21, 2002 7:51 PM
Subject: [PHP] Best Practice



I'm working on converting several static (price) pages on our site into dynamic 
pages, with the data stored in an MySQL database and PHP to pull the data out, with 
CSS to build the page and present it.  At the same time, I would also like to have a 
'printer friendly' link on each page that visitors can click on and get the same page 
re-rendered for easy printing.  What's the best way to get the data converted from one 
form to another?  Should I be querying the database again to get the same data to 
reformat?  Should I store the data in sessions and reformat based on the CSS?  I would 
think having to query twice for the same thing would be a degradation in performance, 
right?  So what's the best practice?

--
H | Life is the art of drawing without an eraser. - John Gardner
  +
  Ashley M. Kirchner mailto:[EMAIL PROTECTED]   .   303.442.6410 x130
  Director of Internet Operations / SysAdmin. 800.441.3873 x130
  Photo Craft Laboratories, Inc.. 3550 Arapahoe Ave, #6
  http://www.pcraft.com . .  ..   Boulder, CO 80303, U.S.A.




-- 
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




Re: [PHP] Best Practice

2002-09-21 Thread Peter J. Schoenster

On 21 Sep 2002 at 12:51, Ashley M. Kirchner wrote:

 
 I'm working on converting several static (price) pages on our site
 into dynamic pages, with the data stored in an MySQL database and
 PHP to pull the data out, with CSS to build the page and present it.

I don't see how CSS would build anything, I guess it's just 
terminology.

  At the same time, I would also like to have a 'printer friendly'
 link on each page that visitors can click on and get the same page
 re-rendered for easy printing.  What's the best way to get the data
 converted from one form to another?  Should I be querying the
 database again to get the same data to reformat?  Should I store the
 data in sessions and reformat based on the CSS?  I would think
 having to query twice for the same thing would be a degradation in
 performance, right?  So what's the best practice?

I have not idea what the best practice is. If your data changes 
infrequently you could build static pages, nothing faster than static 
pages. Few people work on sites where most of these questions mean 
much. A friend worked on a site that he and I had developed and I left 
the firm and he later said the customer was complaining about response 
time .. I suggested he take the query string and cache the response in 
a db file and check that db file for every incoming request rather than 
going to Oracle (yeah, they were using Oracle when mysql would have 
done fine). They opted to just bolster the hardware, end of complaints 
and it was running plain cgi, not even mod_perl. Oh well.

I do something that few people do. I take a request from the *client* 
and I process it. Just data manipulation. Since I'm doing the web I get 
an html template (from Smarty.php.net in this case) and do a merge. I 
like to use a wrapper, as such:

$data contains an array or arrays of whatever which is all the data 
needed for this page (based on the query string in the request). It is 
the body of the page (I've got smarty in my own class, viewer):

$data['content'] = $g-viewer-Merge($data,$template); 

Now, I merge everything with the WRAPPING page:

print  $g-viewer-Merge($data,'index.html'); 

Here is my index.html page ($content is the body of the page):

{include file=inc/header.html}

{include file=../site_nav.html}
table width=80%
tr
td valign=top width=25%

{include file=./left_nav.html}

/td
td  valign=top width=74%
{$content}
/td
/tr
/table

{include file=inc/footer.html}

__END index.html

So if you want to show a printable page just do something like this:

if($print == 1) {
print  $g-viewer-Merge($data,'print_index.html'); 

where print_index.html would have a different layout, perhaps minimal 
header and footer or none at all. Or you  could do some processing on 
the data or whatever. 


Peter











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




Re: [PHP] Best Practice

2002-09-21 Thread @ Edwin

Hi there,

On Sunday, September 22, 2002 12:20 PM
Subject: Re: [PHP] Best Practice
Peter J. Schoenster wrote:
snip
 On 21 Sep 2002 at 12:51, Ashley M. Kirchner wrote:

 
  I'm working on converting several static (price) pages on our site
  into dynamic pages, with the data stored in an MySQL database and
  PHP to pull the data out, with CSS to build the page and present it.

 I don't see how CSS would build anything, I guess it's just
 terminology.

/snip

Actually, in a sense, CSS can "build" a page--esp. if "build" means how data
are to be presented (formatted) by the browser. Remember, with CSS you can
hide and unhide elements?

For the original question...

   At the same time, I would also like to have a 'printer friendly'
  link on each page that visitors can click on and get the same page
  re-rendered for easy printing.  What's the best way to get the data
  converted from one form to another?  Should I be querying the
  database again to get the same data to reformat?  Should I store the
  data in sessions and reformat based on the CSS?  I would think
  having to query twice for the same thing would be a degradation in
  performance, right?  So what's the best practice?


The best practice, IMHO, is the one implemented here:

  http://www.alistapart.com/

Try the page with your standard-compliant browser (like N7) and with a
(crappy) browser like N4 and see the difference. You can "dissect" the site
and find out how they did it. Or, you can read articles like this:

  http://www.alistapart.com/stories/netscape/

And one for "easy printing":

  http://www.alistapart.com/stories/goingtoprint/

- E

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


Re: [PHP] Best Practice

2002-09-21 Thread Peter J. Schoenster

On 22 Sep 2002 at 12:31,  Edwin wrote:

 Actually, in a sense, CSS can build a page--esp. if build means how
 data are to be presented (formatted) by the browser. Remember, with CSS
 you can hide and unhide elements?

Ah .. yes ... forgot about that. That is building. Appreciate the 
reminder.

 The best practice, IMHO, is the one implemented here:
 
   http://www.alistapart.com/
 
 Try the page with your standard-compliant browser (like N7) and with a
 (crappy) browser like N4 and see the difference. You can dissect the
 site and find out how they did it. Or, you can read articles like this:
 
   http://www.alistapart.com/stories/netscape/
 
 And one for easy printing:
 
   http://www.alistapart.com/stories/goingtoprint/

I gotta go back and refresh myself. Thanks for the links. 


Peter

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




RE: [PHP] Best practice question

2002-09-20 Thread Ford, Mike [LSS]

 -Original Message-
 From: Jon Haworth [mailto:[EMAIL PROTECTED]]
 Sent: 19 September 2002 18:18
 
 What are peoples' thoughts on one should always return a value from a
 function, even if it's always going to be true?

Unprintable!!

There's no point in returning a value if there's no sensible value to return.

Confusion can arise because PHP uses function for what, in some other languages, are 
distinguished into functions (which must return a value) and subroutines (which 
cannot).  Anyone insisting that a function must return a result have probably been 
exposed only (or primarily) to such languages ;-Z !!

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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




Re: [PHP] Best practice question

2002-09-19 Thread Adam Voigt

One extra variable to be declared to catch the true (if you do try
and catch it) and one extra line (the return line in the function),
I'd say skip it if you know your never returning anything different.

Adam Voigt
[EMAIL PROTECTED]

On Thu, 2002-09-19 at 13:17, Jon Haworth wrote:
 Hi list,
 
 What are peoples' thoughts on one should always return a value from a
 function, even if it's always going to be true?
 
 Cheers
 Jon
 
 -- 
 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




RE: [PHP] Best practice question

2002-09-19 Thread Jon Haworth

Hi Adam,

  What are peoples' thoughts on one should always return 
  a value from a function, even if it's always going to be 
  true?
  
 I'd say skip it if you know your never returning anything 
 different.

Yeah, that's what I was leaning towards :-)

What prompted the question was a constructor like this:

class foo {
  var $timestamp;
  function foo () {
$this-timestamp = mktime();
  }
}

I just can't see any reason to return anything from it, unless someone wants
to tell me otherwise...

Cheers
Jon

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




RE: [PHP] Best Practice-HTML In Database

2001-05-01 Thread Mark Roedel

 -Original Message-
 From: John Monfort [mailto:[EMAIL PROTECTED]]
 Sent: Monday, April 30, 2001 5:08 PM
 To: Mark Roedel
 Cc: [EMAIL PROTECTED]
 Subject: RE: [PHP] Best Practice-HTML In Database
 
 
 Yes,  I will need to provide searching capabilities.
 
 Basically, I'm creating an online referencing system with a 
 db backend.  A user will be able to search for a manual,
 and/or browse to a particular  section of the manual.
 
 It's similar to the online PHP manual...at least, in concept.
 
 
 So, in the long run, which will be more beneficial:
 1) HTML code inside the db fields?
or
 2) HTML URL inside the field?

Well, I know I'm going against most of the rest of the responses you've
gotten, but if you think you're going to need to do databasey things
with the material, it makes sense to me to put it in a database.

Having said that, I do agree with a lot of what the other posters have
said regarding things like the impact on ease of maintenance, waste of
storage space, etc.

If it were me, I think I'd be looking for a way to only store the actual
text in the database, with some PHP scripting to apply whatever
formatting/template is needed to generate the page you want to present.


---
Mark Roedel ([EMAIL PROTECTED])  ||  There cannot be a crisis next week.
Systems Programmer / WebMaster  ||   My schedule is already full.
 LeTourneau University  ||-- Henry Kissinger


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Best Practice-HTML In Database

2001-04-30 Thread Mark Roedel

 -Original Message-
 From: John Monfort [mailto:[EMAIL PROTECTED]]
 Sent: Sunday, April 29, 2001 10:40 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Best Practice-HTML In Database
 
 
 Hello everyone,
 
 I'm curious. Which is the better practice?

 1) Insert the HTML page (...HTML code) in the database ?
 
or
 
 2) Insert a URL in the database field, that points to the 
 HTML page?
 
 why?

Will you ever want to do database-ish things with the contents of the
page?  (Allow somebody to search for words or phrases in the body, for
example?)


---
Mark Roedel ([EMAIL PROTECTED])  ||  There cannot be a crisis next week.
Systems Programmer / WebMaster  ||   My schedule is already full.
 LeTourneau University  ||-- Henry Kissinger


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Best Practice-HTML In Database

2001-04-30 Thread John Monfort




  Yes,  I will need to provide searching capabilities.

  Basically, I'm creating an online referencing system with a db backend.
  A user will be able to search for a manual, and/or browse to a
  particular  section of the manual.

  It's similar to the online PHP manual...at least, in concept.


  So, in the long run, which will be more beneficial:
1) HTML code inside the db fields?
   or
2) HTML URL inside the field?


__John Monfort_
_+---+_
 P E P I E  D E S I G N S
   www.pepiedesigns.com
The world is waiting, are you ready?
-+___+-

On Mon, 30 Apr 2001, Mark Roedel wrote:

  -Original Message-
  From: John Monfort [mailto:[EMAIL PROTECTED]]
  Sent: Sunday, April 29, 2001 10:40 PM
  To: [EMAIL PROTECTED]
  Subject: [PHP] Best Practice-HTML In Database
 
 
  Hello everyone,
 
  I'm curious. Which is the better practice?
 
  1) Insert the HTML page (...HTML code) in the database ?
 
 or
 
  2) Insert a URL in the database field, that points to the
  HTML page?
 
  why?

 Will you ever want to do database-ish things with the contents of the
 page?  (Allow somebody to search for words or phrases in the body, for
 example?)


 ---
 Mark Roedel ([EMAIL PROTECTED])  ||  There cannot be a crisis next week.
 Systems Programmer / WebMaster  ||   My schedule is already full.
  LeTourneau University  ||-- Henry Kissinger




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Best Practice-HTML In Database

2001-04-29 Thread Michael Hall


If you ever need to update the HTML, option 2 will be a lot easier.

Mick

On Sun, 29 Apr 2001, John Monfort wrote:

 
   Hello everyone,
 
   I'm curious. Which is the better practice?
1) Insert the HTML page (...HTML code) in the database ?
 
or
 
2) Insert a URL in the database field, that points to the HTML page?
 
 
   why?
 
   Any help will be appreciated.
 
   Btw, thank you all for helping with my previous questions.
 
  ==FOLLOW-UP ==-
  = PHP Ultradev Browser Model ==
  ===
 
  FYI
   For those who care about the PHP-Ultradev Server Model (PHAKT).
   I finally got it to work. Everything works for MySQL.
   However, you have to make some manual changes for it to work with MS
   Access. The changes are as follow:
 
1) You have to add the 'Access' or 'ODBC' Connection Type, in the
   server model's CONNECTION File
   (accessed via Modify-Connection-New).
 
   To do so:
a) open (from the Ultradev Configuration folder)
Connection-PHP-Win-Connection_php_adodb.htm
 
b) add the value pairs  access/access, and/or odbc/odbc, to the
   dropdown list for 'Connection Type'.
 
Without this, you can only select MySQL as the connection type.
This means that ADOBD will use the wrong drivers to connect to
your DB.
 
   2) There is an ERROR in the ADODB ODBC configuration file. The ODBC
  file has a format error in the ODBC connection call.
  (Site Root Folder -ADODB-adodb-odbc.inc.php)
 
The file tries to connect (to the DB) with
 
$dbh = odbc_connect ('$hostname', $username,$password);
 
That is an error. The correct format is
 
$dbh = odbc_connect ('$DSN_NAME', $username, $password);
 
You do not need to specify the host, for an ODBC connection. That
information is already listed in the DSN description.
 
 
Once that's done. You'll be able to use Ultradev with PHP.
 
I hope that helped.
 
-John
 
Again, thanks to everyone who helped me find this extension.
Don't forget my new question :)  see above.
 
 
 
 
 __John Monfort_
 _+---+_
  P E P I E  D E S I G N S
www.pepiedesigns.com
 The world is waiting, are you ready?
 -+___+-
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]
 
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Best Practice-HTML In Database

2001-04-29 Thread Donald Goodwill

Using an URL to point to an HTML page or file is
better.

Inserting the HTML page in the database would cause:
a) more database requests and thus heavy load on the
database
b) large amount traffic between the database server
and the web server

At my previous company we even ended up removing the
text from the database and placing it as files on the
disk...


--- John Monfort [EMAIL PROTECTED]
wrote:
 
   Hello everyone,
 
   I'm curious. Which is the better practice?
1) Insert the HTML page (...HTML code) in the
 database ?
 
or
 
2) Insert a URL in the database field, that
 points to the HTML page?
 
 
   why?
 
   Any help will be appreciated.
 
   Btw, thank you all for helping with my previous
 questions.
 
  ==FOLLOW-UP ==-
  = PHP Ultradev Browser Model ==
  ===
 
  FYI
   For those who care about the PHP-Ultradev Server
 Model (PHAKT).
   I finally got it to work. Everything works for
 MySQL.
   However, you have to make some manual changes for
 it to work with MS
   Access. The changes are as follow:
 
1) You have to add the 'Access' or 'ODBC'
 Connection Type, in the
   server model's CONNECTION File
   (accessed via Modify-Connection-New).
 
   To do so:
a) open (from the Ultradev Configuration
 folder)
   
 Connection-PHP-Win-Connection_php_adodb.htm
 
b) add the value pairs  access/access, and/or
 odbc/odbc, to the
   dropdown list for 'Connection Type'.
 
Without this, you can only select MySQL as
 the connection type.
This means that ADOBD will use the wrong
 drivers to connect to
your DB.
 
   2) There is an ERROR in the ADODB ODBC
 configuration file. The ODBC
  file has a format error in the ODBC connection
 call.
  (Site Root Folder -ADODB-adodb-odbc.inc.php)
 
The file tries to connect (to the DB) with
 
$dbh = odbc_connect ('$hostname',
 $username,$password);
 
That is an error. The correct format is
 
$dbh = odbc_connect ('$DSN_NAME', $username,
 $password);
 
You do not need to specify the host, for an ODBC
 connection. That
information is already listed in the DSN
 description.
 
 
Once that's done. You'll be able to use Ultradev
 with PHP.
 
I hope that helped.
 
-John
 
Again, thanks to everyone who helped me find this
 extension.
Don't forget my new question :)  see above.
 
 
 
 
 __John Monfort_
 _+---+_
  P E P I E  D E S I G N S
www.pepiedesigns.com
 The world is waiting, are you ready?
 -+___+-
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail:
 [EMAIL PROTECTED]
 For additional commands, e-mail:
 [EMAIL PROTECTED]
 To contact the list administrators, e-mail:
 [EMAIL PROTECTED]
 


__
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]