php-general Digest 21 Sep 2009 10:08:57 -0000 Issue 6350

Topics (messages 298206 through 298221):

Re: Creating file name with $variable
        298206 by: Ralph Deffke
        298208 by: Tommy Pham
        298216 by: Lars Torben Wilson

more info. help?
        298207 by: johny why

Is an E_STRICT warning when overwriting a static method with a different 
parameter list desired?
        298209 by: Martijn Evers

Usage of strlen(tuf8_decode()) and "/u" regex modifier
        298210 by: GoForThisWorld

Best Practice to Create Dynamic URL's- With Username
        298211 by: Gaurav Kumar
        298212 by: Ashley Sheridan
        298213 by: Tommy Pham
        298214 by: Ralph Deffke
        298215 by: Richard Heyes
        298217 by: Gaurav Kumar
        298218 by: Andrea Giammarchi
        298219 by: Gaurav Kumar
        298220 by: Ashley Sheridan
        298221 by: Gaurav Kumar

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
        php-gene...@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
Hi Haig,

it would be better if u tell us what purpose u want to solf with this
approuch. Its hard to understand for a prov why u want to create a filename
.php
.php files are scrips containing functions or classes, called/instantinated
with parameters.
why the hell u want to create a filename with these parameters? does this
file excist?
you can create 'dynamic code' in php, but u would never write it to a file!

understand that that question is wierd and appears that ur concept is wild
and realy sick.

ralph_def...@yahoo.de

"Haig Davis" <level...@gmail.com> wrote in message
news:46c80589-5a86-4c10-8f23-389a619bf...@gmail.com...
> Good Afternoon All,
>
> Thanks for the help with the checkbox issue the other day.
>
> Todays question: I want to create a filename.php from a variable more
> specifically the results if a mySQL query I.e. userID + orderNumber =
> filename. Is this possible? 'cause I've tried every option I can think
> of and am not winng.
>
> Thanks a ton
>
> Haig
>
> Sent from my iPhone



--- End Message ---
--- Begin Message ---
----- Original Message ----
> From: Ralph Deffke <ralph_def...@yahoo.de>
> To: php-gene...@lists.php.net
> Sent: Sunday, September 20, 2009 3:43:24 PM
> Subject: [PHP] Re: Creating file name with $variable
> 
> Hi Haig,
> 
> it would be better if u tell us what purpose u want to solf with this
> approuch. Its hard to understand for a prov why u want to create a filename
> .php
> .php files are scrips containing functions or classes, called/instantinated
> with parameters.
> why the hell u want to create a filename with these parameters? does this
> file excist?
> you can create 'dynamic code' in php, but u would never write it to a file!
> 
> understand that that question is wierd and appears that ur concept is wild
> and realy sick.
> 
> ralph_def...@yahoo.de
> 
> "Haig Davis" wrote in message
> news:46c80589-5a86-4c10-8f23-389a619bf...@gmail.com...
> > Good Afternoon All,
> >
> > Thanks for the help with the checkbox issue the other day.
> >
> > Todays question: I want to create a filename.php from a variable more
> > specifically the results if a mySQL query I.e. userID + orderNumber =
> > filename. Is this possible? 'cause I've tried every option I can think
> > of and am not winng.
> >
> > Thanks a ton
> >
> > Haig
> >
> > Sent from my iPhone
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

Perhaps he's trying to do URL rewrite without the URL rewrite?


--- End Message ---
--- Begin Message ---
On Mon, 21 Sep 2009 00:43:24 +0200
"Ralph Deffke" <ralph_def...@yahoo.de> wrote:

> Hi Haig,
> 
> it would be better if u tell us what purpose u want to solf with this
> approuch. Its hard to understand for a prov why u want to create a
> filename .php
> .php files are scrips containing functions or classes,
> called/instantinated with parameters.
> why the hell u want to create a filename with these parameters? does
> this file excist?
> you can create 'dynamic code' in php, but u would never write it to a
> file!
> 
> understand that that question is wierd and appears that ur concept is
> wild and realy sick.
> 
> ralph_def...@yahoo.de

Hi Ralph,

First, please don't top-post.

Second, please use complete words. 'u' is not a word.

Third, I have no idea why you feel that such an knee-jerk reaction and
abusive post would be helpful or useful. If you have nothing to add to
the conversation, do not post. 

> "Haig Davis" <level...@gmail.com> wrote in message
> news:46c80589-5a86-4c10-8f23-389a619bf...@gmail.com...
> > Good Afternoon All,
> >
> > Thanks for the help with the checkbox issue the other day.
> >
> > Todays question: I want to create a filename.php from a variable
> > more specifically the results if a mySQL query I.e. userID +
> > orderNumber = filename. Is this possible? 'cause I've tried every
> > option I can think of and am not winng.
> >
> > Thanks a ton
> >
> > Haig

Hi Haig,

Yes, this is possible; there is nothing special about creating such a
file. Simply construct the filename as a string in normal PHP fashion,
and then use that filename with file_put_contents(), fopen(), or
similar, to create the file. 

It will be hard to help you further without an example (as short as you
can make it) of what you are trying to do, and an explanation of how
it's failing to do what you want it to do.

Please post a short example of the code you have which is failing, and
a longer explanation of exactly what you want to achieve, and perhaps we
can explain how to make it work or suggest a better solution to your
problem.

Ralph did get one thing right, in that it's generally better to explain
what you're trying to do instead of explaining how you're trying to do
it. There are many ways to do almost any task, so it is possible that
there is another way to do what you want which is simpler and less
error-prone.


Regards,

Torben

--- End Message ---
--- Begin Message ---
webhost tells me they do not support PHPRC in htaccess.

any help?


--- End Message ---
--- Begin Message ---
Hi,

I was wondering if an E_STRICT error is desired when a static method is overwritten with a other parameter list.

The error I'am getting is:
"Strict Standards: Declaration of Sub::doSomething() should be compatible with that of Base::doSomething()"

When I run this code:
---------------------------------------------------------------------------
class Base
{
        public static function doSomething($something)
        {
                echo $something;
        }
}

class Sub extends Base
{
        public static function doSomething()
        {
                parent::doSomething('anything');
        }
}


But why? Aren't interfaces supposed to handle this?

NOTE: Be sure to have E_STRICT enabled in the ini or a file including this one. E_STRICT errors are not reported in the file where error_reporting is used to set E_STRICT. (personal experience :P )
--- End Message ---
--- Begin Message ---
Hello,

  As indicated below, the "strlen(tuf8_decode())" and the "/u" regex 
  modifier do not work as per my understanding.  

  1) What is my misunderstanding?  

      <?php
      
          $the_string = '&#1052;&#1072;&#1088;&#1080;&#1085;&#1072; 
&#1054;&#1088;&#1083;&#1086;&#1074;&#1072;';
          echo "<p>author (85 bytes):$the_string," . strlen($the_string) . ',' 
. strlen( utf8_decode( $the_string ) ) . ',' .
strlen( utf8_decode( utf8_encode($the_string) ) ) . ',' .  "</p>";
          // all the number echoed are 85, I expected at least one to be 13

          
          $max_length = 20;
          $is_short = preg_match( '/^.{1,$max_length}$/u', uft8_encode( 
$the_string ) ) );
          // expect the above to return 1
          
          $max_length = 10;
          $is_short = preg_match( '/^.{1,$max_length}$/u', uft8_encode( 
$the_string ) ) );
          // expect the above to return 0
      
      ?>

  More generally, given a string $the_string:

  2) how to determine what encoding is being used?

  3) how to determine the number of visible characters?

  4) if it has more than N visible characters, how to 
     truncate it after N visible characters?

  Thanks!


--- End Message ---
--- Begin Message ---
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

--- End Message ---
--- Begin Message ---
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




--- End Message ---
--- Begin Message ---
----- Original Message ----
> From: Gaurav Kumar <kumargauravjuke...@gmail.com>
> To: php-gene...@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


--- End Message ---
--- Begin Message ---
be aware if you do not have full control of your server setup, this type of
parameter handling is not possible on most shared hostings.

however url encoded it is never a problem. so be clear where yout page will
be hosted.

ralph_def...@yahoo.de

"Gaurav Kumar" <kumargauravjuke...@gmail.com> wrote in message
news:87292e170909210054k79858b96yf09eeca5111ec...@mail.gmail.com...
> 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
>



--- End Message ---
--- Begin Message ---
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

--- End Message ---
--- Begin Message ---
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=username>So 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.uk>wrote:

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

--- End Message ---
--- Begin Message ---


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

--- End Message ---
--- Begin Message ---
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<http://www.microsoft.com/windows/windowslive/>
>

--- End Message ---
--- Begin Message ---
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




--- End Message ---
--- Begin Message ---
Thanks Ashley and all the folks out there...

On Mon, Sep 21, 2009 at 3:25 PM, Ashley Sheridan
<a...@ashleysheridan.co.uk>wrote:

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

--- End Message ---

Reply via email to