php-general Digest 17 May 2007 05:00:27 -0000 Issue 4795

Topics (messages 255020 through 255042):

pdo-oracle + nls_lang environment variable...
        255020 by: Javier Ruiz

Mysqli insert / OO Design Problem - Call to a member function bind_param() on a 
non-object in...
        255021 by: Lee PHP
        255034 by: Chris

mime type over http post?
        255022 by: Ray
        255024 by: Stephen
        255027 by: Ray
        255031 by: Tijnema !
        255040 by: Oliver Block

Re: using preg_match
        255023 by: M.Sokolewicz
        255036 by: Chris

Boilerplate Requirements Document for Web Site
        255025 by: Stephen

Re: PHP debugger
        255026 by: Miles Thompson

Re: Boilerplate Requirements Document for Web Site Kinda' OT
        255028 by: Jay Blanchard

delete_global_variable & session_unset
        255029 by: Stanislav Malyshev
        255035 by: Chris
        255037 by: Stanislav Malyshev

Static methods have access to private members
        255030 by: Theodore Root

Download speed limit
        255032 by: Rangel Reale
        255033 by: Jim Lucas
        255038 by: Rangel Reale

Extracting Variables From URL
        255039 by: CK
        255041 by: J R

Random SELECT SQL list
        255042 by: Eduardo Vizcarra

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


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

I'm using pdo-oci on php-5.2.2 against an oracle-10g server, using
oracle-instantclient (compiled oracle with
'--with-oci8=instantclient,/usr/lib/oracle/10.2.0.3/client/lib').

The problem...:
I make a simple php script that makes a select from a table. The table
contains spanish characters so I set the enviroment variable NLS_LANG to
SPANISH_SPAIN.AL32UTF8 before running apache (also tried other values that
use iso8859-1...). If I run the script in console (using the CLI version of
php) the returned data is in the desired collation, so I can see the spanish
special characters like "ñ", "ó" and so on... The problem is that running
exactly the same script via HTTP (apache2) I always get question marks
replacing the special characters...

I tried many things... I export the enviroment variable as root and as the
user running the apache daemon, I modified the apache init script to export
the variables just before starting apache, I tried using the putenv function
in php code and no luck at all...

I realized about something that maybe is related... a php script running in
CLI can access any environmental variable, but no any env-var running in
apache... for example the following code:  <?php echo getenv("LC_ALL"); ?>
will return my locale setting in CLI but returns nothing via http... is it
normal?

TIA!

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

I'm new to OO-PHP and have encountered a problem that I just can't
figure out. I have a class called DBAccess that extends mysqli. In a
nutshell, it looks like this:

class DBAccess extends mysqli {
   private static $instance;
   private static $preferences;

   /** Create an instance of DBAccess. */
   private function __construct($host, $port, $user, $pass, $name) {
       self::$instance = parent::__construct($host, $user, $pass, $name);
   }

   /** Populate and/or return an instance of DBAccess. */
   public function getInstance() {
       if (empty(self::$instance)) {
           $preferences = Preferences::getInstance();

           // Let's set the database defaults if not previously set.
           if (self::$host == null) {
                   DBAccess::setHost($preferences->getProperty("TestDbHost"));
           }
                        
           if (self::$port == null) {
                   DBAccess::setPort($preferences->getProperty("TestDbPort"));
           }
                        
           if (self::$user == null) {
                   DBAccess::setUser($preferences->getProperty("TestDbUser"));
           }
                        
           if (self::$pass == null) {
                   DBAccess::setPass($preferences->getProperty("TestDbPass"));
           }
                        
           if (self::$name == null) {
                   DBAccess::setName($preferences->getProperty("TestDbName"));
           }

           self::$instance = new DBAccess(self::$host, self::$port,
               self::$user, self::$pass, self::$name);

           return self::$instance;
       }
   }

   .
   .
   .
}

I also have a class, call it MyClass, that tries to connect using
DBAccess and insert a record. It can connect to the database, but
encounter a problem (Call to a member function bind_param() on a
non-object) when I try to insert a record. Here's the MyClass class
(some of the complexity removed):

class MyClass {
   private static $conn;
   private static $preferences;

   /** Create an instance of ContactInformation. */
   public function __construct() {
       self::$conn = DBAccess::getInstance();
       self::$preferences = Preferences::getInstance();
   }

   /** Populate instance. */
   public function set($args) {
      // Calls to $this->set<ARG>;
   }

   /** Insert record. */
   public function insert() {
       $sql = "INSERT INTO table (" .
               "field_1, " .
               "field_2, " .
               "field_3) " .
               "?, " .
               "?, " .
               "?)";
       echo "Server version: " .  self::$conn->server_info;
       $stmt = self::$conn->prepare($sql);
       $stmt->bind_param('sssssssssssss',
               $this->getField1(),
               $this->getField2(),
               $this->getField3());
       $stmt->execute();
       $stmt->close();
   }
}

If I execute the following code:

$conn = DBAccess::getInstance();
$someClass = new Class();
$someClass->set(<ALL THE ARGS);
$someClass->insert();

I see the following output:

Server version: 5.0.21-Debian_3ubuntu1-log
Fatal error: Call to a member function bind_param() on a non-object in
C:\blah\blah\blah

The fact that the server version is correctly displayed, suggests that
it is connecting. Why is it having issues with the $stmt? Anyone know?

The smallprint:
The DBAccess class looks a little funky - I'm playing around with the
Singleton Design Pattern, and plan to refine it once I get the kinks
(like this) worked out.

Thanks in advance for any thoughts.

- Leee

--- End Message ---
--- Begin Message ---
Lee PHP wrote:
Hi there,

I'm new to OO-PHP and have encountered a problem that I just can't
figure out. I have a class called DBAccess that extends mysqli. In a
nutshell, it looks like this:

<snip>

If I execute the following code:

$conn = DBAccess::getInstance();

Does that give you an object? Check with:

var_dump($conn);

If that works, does:

$someClass = new Class();

set up the $someClass->conn variable properly?

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

--- End Message ---
--- Begin Message ---
Hello,
I'm trying to write a web-based aplication that talks to a third party server. 
I'm having a hard time getting support from from them. the method of 
comunication (direct quote from their docs is:
"Data will be transferred to [server] via an HTTP POST operation using the 
MIME type, text/xml"

can anybody tell me what this means or how I do it using php?
Thanks,
Ray

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

I'm having a hard time getting support from from them. the method of comunication (direct quote from their docs is: "Data will be transferred to [server] via an HTTP POST operation using the MIME type, text/xml"
They want you to mimic what a browser would send to a web site when the user clicks a "send" button in a form.

You use PHP to create the header for the page request, but you need to study HTTP documentation to understand what you need to send. It seems very unreasonable of them to have not supplied sample code.

Good luck.
Stephen

--- End Message ---
--- Begin Message ---
On Wednesday 16 May 2007 11:12 am, Stephen wrote:
> > I'm having a hard time getting support from from them. the method of
> > comunication (direct quote from their docs is:
> > "Data will be transferred to [server] via an HTTP POST operation using
> > the MIME type, text/xml"
>
> They want you to mimic what a browser would send to a web site when the
> user clicks a "send" button in a form.

Hi,
They have supplied very detailed docs for the XML,  but the part that really 
throws me Is the mime type. Is this just another header? 
Thanks, 
Ray

>
> You use PHP to create the header for the page request, but you need to
> study HTTP documentation to understand what you need to send. It seems
> very unreasonable of them to have not supplied sample code.
>
> Good luck.
> Stephen

--- End Message ---
--- Begin Message ---
On 5/16/07, Ray <[EMAIL PROTECTED]> wrote:
On Wednesday 16 May 2007 11:12 am, Stephen wrote:
> > I'm having a hard time getting support from from them. the method of
> > comunication (direct quote from their docs is:
> > "Data will be transferred to [server] via an HTTP POST operation using
> > the MIME type, text/xml"
>
> They want you to mimic what a browser would send to a web site when the
> user clicks a "send" button in a form.

Hi,
They have supplied very detailed docs for the XML,  but the part that really
throws me Is the mime type. Is this just another header?
Thanks,
Ray

Yes, it is just another header, you could analyze the headers sent to
and from with for example a network sniffer. Or you just connect to
the protocol directly with programs like putty or telnet.

Tijnema

>
> You use PHP to create the header for the page request, but you need to
> study HTTP documentation to understand what you need to send. It seems
> very unreasonable of them to have not supplied sample code.
>
> Good luck.
> Stephen

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



--- End Message ---
--- Begin Message ---
Hello Ray,

1. create the xml markup (dom)
2. open a connection to the 3rd party server (fsockopen)
3. send the header (fputs)
4. send the body (fputs)
5. close the connection

Additional Questions?

Best Regards,

Oliver

P.S: I just know better where to look for information:-)

----- original Nachricht --------

Betreff: [PHP] mime type over http post?
Gesendet: Mi, 16. Mai 2007
Von: Ray<[EMAIL PROTECTED]>

> Hello,
> I'm trying to write a web-based aplication that talks to a third party
> server. 
> I'm having a hard time getting support from from them. the method of 
> comunication (direct quote from their docs is:
> "Data will be transferred to [server] via an HTTP POST operation using the 
> MIME type, text/xml"
> 
> can anybody tell me what this means or how I do it using php?
> Thanks,
> Ray
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

--- original Nachricht Ende ----

--- End Message ---
--- Begin Message ---
Ed Curtis wrote:
Christian Haensel wrote:
Hi Ed,

did you try the backslash as escape character?

<?
$path = "testing/realtors/userdata/";
if(preg_match("/\/realtors/", $path)) {
echo 'Success';
}
?>

That's what did it. I was thinking the \ was the escape for the command but wanted to make sure.

Thanks!
Why didn't you just test it yourself? Most people (well, I hope) would try it out, find out it worked, and used it. Instead you asked it on a mailinglist, waited, and then got your answer. It took you longer to do this, it cost you more (because `time is money!`(TM)).... why....???
--- End Message ---
--- Begin Message ---
Ed Curtis wrote:
I'm trying to use preg_match to find a string in a system path.

What I need to do is see if the string '/realtors' exists in a variable named '$path'.

I know '/' is used as a container within the command itself. How do I escape it to find the string '/realtors'?

http://www.php.net/preg_quote

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

--- End Message ---
--- Begin Message ---
Can anyone provide or direct me to the subject?

I need more than a checklist of what to include. Something to go over with the client, complete the sections, and create a document to determine scope and determine price.

Thanks
Stephen

--- End Message ---
--- Begin Message ---
On 5/16/07, Arno Kuhl <[EMAIL PROTECTED]> wrote:
-----Original Message-----
From: Miles Thompson [mailto:[EMAIL PROTECTED]
Sent: 16 May 2007 02:15
To: PHP List
Subject: Re: [PHP] PHP debugger

>
>
> -----Original Message-----
> From: Miles Thompson [mailto:[EMAIL PROTECTED]
> Sent: 15 May 2007 08:21
> To: PHP List
> Subject: [PHP] PHP debugger
>
>
> I am trying to load a PHP debugger in our most recent build of PHP 5.2.1.
>
> The debugger which I am trying to set up is the free, pre-compiled
> Linux version of dbg ( DBG 2.15.5 dbg modules), from
> http://dd.cron.ru/dbg/, and all of the instructions have been followed
> as posted on the NuSphere site.
>
> Yes, Apache has been stopped and restarted!!
>
> There is no difference in the output from phpinfo(). The line
> "with DBG v2.11.30, (C) 2000,2004 by Dmitri Dmitrienko, http://dd.cron.ru";
> does not appear.
>
> PHP is compiled without debugging, but I did consider that was for the
> purpose of debugging PHP itself, not scripts.
>
> Suggestions will be most welcome. Also, I'm not married to this, so if
> anyone thinks there is a better debugger, please jump in.
>
> Regards - Miles Thompson
< snipped some trivial comments>
>

On 5/16/07, Arno Kuhl <[EMAIL PROTECTED]> wrote:
> If you don't see any change in phpinfo then maybe it's not picking up the
> dbg extension in your php.ini. Presumably you've also put the other
debugger
> directives in your ini?
>
> You can also try download the trial version of PHPEd from Nusphere,
install
> that, and check how it configures the debugger. The trial lasts a month I
> think, so maybe you'll sort out your problems in that time anyway. Just be
> sure to completely uninstall it afterwards because I think the free dbg
> version is not the same as the version integrated in PHPEd. Any version
> differences cause the extension to not load, though in that case it should
> report an error. You can't use the dbg integrated in PHPEd after uninstall
> because it doesn't work without PHPEd.
>
> Arno

From my php.ini ....
; added debug extension "dbg.so-5.2.x" and
; see [debugger] section of this file -  20050515 - mthompson
;
extension=dbg.so  ;dbg.so-5.2.x

and the [debugger] section ...
; Added [debugger] section 20050515 - mthompson
; Note:  DBG versions 2.15 (free) does not support debugger.hosts_allow,
; debugger.hosts_deny or debugger.ports settings.
;
[debugger]
debugger.enabled=on
debugger.profiler_enabled=on
debugger.hosts_allow= <<inserted domain and IP number here>>
debugger.hosts_deny=ALL
debugger.ports=7869, 10000/16
; end [debugger] section

Couple of notes:
1. Tried this with extension pointing to both dbg.so and dbg.so-5.2.x.
(The latter is what the instructions specified, but that did not seem
correct.)

2. Also tried it, in combination with above, with  debugger.hosts_allow,
debugger.hosts_deny and debugger.ports all commented out.

3. PHP version is 5.2.1, compiled from source on a Ubuntu Edgy Eft server.

I'm wondering it I should download the source and compile it. That
might be a better way home than assuming the binary is correct.

Arno, your suggestion to install the NuSphere editor is a good one.
I'm just reluctant to add more junk to my Windows box and to allow
something other than atp-get / dselect to mess with server
configuration. (Although it is a development box, so errors are not
terminal!)

Thanks to everyone for suggestions.

Regards - Miles

--

Hi Miles

I'm not sure I follow your configuration - are you running on Windows or
Linux? You shouldn't need to compile anything as far as I'm aware, just use
the binaries.

I'm using PHPEd 5.0 for Windows, so my config won't be the same as yours.

My ini setup is:

================================
extension=php_dbg.dll-4.4.x

[debugger]
debugger.enabled=On
debugger.profiler_enabled=On
================================

I've been using PHPEd for about 3 years so there are several dbg files in my
extensions dir, but the latest is "php_dbg.dll-4.4.x" (that is the actual
file name in extensions directory) which coincides with the name in the ini
file, and the timestamp coincides with the ver 5.0 release date. According
to your description for your Linux box I reckon you should be using
"dbg.so-5.2.x" in your ini file and in your extensions dir.

From previous experience I know the dbg extension is very fussy. You can't
specify more than one dbg in your ini, and the dbg must be the correct one
for your platform and your version of php. You can't change the name of the
file, and if the binary is for one specific ver of php then you must have
that ver of php running. Any error here and it just doesn't work.

Hope that helps

Cheers
Arno


Arno,

Arno,

Thanks for providing the relevant bits of your php.ini. You just
reinforced all of the docs in a very positive way.

So in php.ini the lines in the [debugger] section which are not
supported by the free version are now commented out, the extension is
back to its original name and that's the name pointed to in php.ini.
Apache has been stopped and restarted.

Our version of PHP is 5.2.1, and I'm using dbg.so-5.2.x - should work.
Regretfully, it does not.

(Our clients are Windows and I do hope that we will be able to debug
remotely, when I finally  get this thing working.)

Regards - Miles

--- End Message ---
--- Begin Message ---
[snip]
Can anyone provide or direct me to the subject?

I need more than a checklist of what to include. Something to go over 
with the client, complete the sections, and create a document to 
determine scope and determine price.
[/snip]

Web sites are like elbows and opinions. Everyone has one or two and they
are almost always never the same. I have been in the industry for a long
time and have never seen a boilerplate requirements document for a web
site. It has always been my opinion that the developer is responsible
for listening to the customer and then writing a requirements document.
That document is subject to many revisions before becoming final...and
everyone signs off on it.

Having said that there are some questions to ask (none of them technical
mind you, because the customer doesn't know how a developer
develops...and really does not care);

What do you want your web site to do for you? (advertise, build
community, sell stuff, etc.)
Who will supply the graphics? (you or a design firm)
Who will design the layout? (you or a design firm)
Do you need;
   a. a __________ for staff or users (forum, gallery, etc)
   b. e-commerce (order fulfillment, payment acceptance, etc.)
   c. a maintenance contract (with all conditions spelled out, including
delivery times, do you [the developer] provide a warranty of any type
and what does it cover)
Who will update content? (you or them, and if them what tools do they
expect)

These questions will beget many others....good luck!

--- End Message ---
--- Begin Message ---
I recently noticed that session_unset in 5.2 (and probably in 6) uses
delete_global_variable which looks up global scope and then deletes
variable from it. Fine so far, but it does it in a loop - meaning it
looks for the global scope each time anew for each session variable! Also it seems to go through all CVs every time, which seems to be a waste of time too. Any reason not to do it this way:

1. Fetch the global scope
2. For each CV in the global scope, check if it should be deleted against session hash (since we have hashes it should be quick).

This way instead of stack depth*number of CVs*number of session vars we get only stack depth+number of CVs*hash lookup time. Which should be much better. So anybody sees any reason not to do it?
--
Stanislav Malyshev, Zend Products Engineer
[EMAIL PROTECTED]  http://www.zend.com/

--- End Message ---
--- Begin Message ---
Stanislav Malyshev wrote:
I recently noticed that session_unset in 5.2 (and probably in 6) uses
delete_global_variable which looks up global scope and then deletes
variable from it. Fine so far, but it does it in a loop - meaning it
looks for the global scope each time anew for each session variable! Also it seems to go through all CVs every time, which seems to be a waste of time too. Any reason not to do it this way:

1. Fetch the global scope
2. For each CV in the global scope, check if it should be deleted against session hash (since we have hashes it should be quick).

This way instead of stack depth*number of CVs*number of session vars we get only stack depth+number of CVs*hash lookup time. Which should be much better. So anybody sees any reason not to do it?

Best to ask the php-internals list - they write the C code that does all of this work ;)

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

--- End Message ---
--- Begin Message ---
Best to ask the php-internals list - they write the C code that does all of this work ;)

Yeah, I know, clicked on wrong item, already resent there.
--
Stanislav Malyshev, Zend Products Engineer
[EMAIL PROTECTED]  http://www.zend.com/

--- End Message ---
--- Begin Message --- I have a question regarding static methods in PHP5.x. Specifically, it seems that one can access member variables declared private from static methods, just as you can from instance methods. I was wondering if this is by design, or if this "feature" might go away. I have worked up an example, hopefully it won't get mangled:

<?php

class TestClass
{
   private $myVar;
public static function loadAllObjects()
   {
       $vars = array();
       $tempVar = new TestClass();
       $tempVar->myVar = "Example";
       $vars[] = $tempVar;
return $vars; }
}


$test = TestClass::loadAllObjects();

print_r($test);


?>


This code executes fine on PHP 5.2.0 with no errors or warnings, even though one might say that I have accessed the private $myVar from "outside" the instance of TestClass created in $tempVar. This "feature" is useful to me because I'd like to create a static method on my DB-persisted objects that lets me load an array of all of a given type of object from a database, building each one without having to use setters/getters for each member variable (not because thats difficult, but because its nice to be able to have private members that can't be accessed at all from the outside world), while avoiding "lazy loading". So essentially, my questions is, is the above functionality intended?


Thanks!

-TJ

--- End Message ---
--- Begin Message ---
Hello!

For my application I need to limit the speed that my application sends data, in 
my case a binary file.

I need to send the speed as a parameter, like:

sendfile.php?speed=20000

Would send the file at 20kb/s (forgetting about real byte counts for this 
example).

To send the file, I am doing:

    $fp=fopen($this->contentfile,"rb");
    while(!feof($fp)){
        print(fread($fp,1024*8));
        flush();
        ob_flush();
    }
    fclose($fp);

If after ob_flush I do a sleep(), I can limit the speed, but I would like to 
limit at the speed of the parameter.

Is there a way to do this?

Thanks,
Rangel

--- End Message ---
--- Begin Message ---
Rangel Reale wrote:
Hello!

For my application I need to limit the speed that my application sends data, in 
my case a binary file.

I need to send the speed as a parameter, like:

sendfile.php?speed=20000

Would send the file at 20kb/s (forgetting about real byte counts for this 
example).

To send the file, I am doing:

    $fp=fopen($this->contentfile,"rb");
    while(!feof($fp)){
        print(fread($fp,1024*8));
        flush();
        ob_flush();
    }
    fclose($fp);

If after ob_flush I do a sleep(), I can limit the speed, but I would like to 
limit at the speed of the parameter.

Is there a way to do this?

Thanks,
Rangel

on average, how big are the files that you will be sending?

--
Jim Lucas

   "Some men are born to greatness, some achieve greatness,
       and some have greatness thrust upon them."

Unknown

--- End Message ---
--- Begin Message ---
Between 90 and 350 MB.

----- Original Message ----- From: "Jim Lucas" <[EMAIL PROTECTED]>
To: "Rangel Reale" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Wednesday, May 16, 2007 6:41 PM
Subject: Re: [PHP] Download speed limit


Rangel Reale wrote:
Hello!

For my application I need to limit the speed that my application sends data, in my case a binary file.

I need to send the speed as a parameter, like:

sendfile.php?speed=20000

Would send the file at 20kb/s (forgetting about real byte counts for this example).

To send the file, I am doing:

    $fp=fopen($this->contentfile,"rb");
    while(!feof($fp)){
        print(fread($fp,1024*8));
        flush();
        ob_flush();
    }
    fclose($fp);

If after ob_flush I do a sleep(), I can limit the speed, but I would like to limit at the speed of the parameter.

Is there a way to do this?

Thanks,
Rangel

on average, how big are the files that you will be sending?

--
Jim Lucas

   "Some men are born to greatness, some achieve greatness,
       and some have greatness thrust upon them."

Unknown

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




--
No virus found in this incoming message.
Checked by AVG Free Edition. Version: 7.5.467 / Virus Database: 269.7.0/803 - Release Date: 13/5/2007 12:17



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

The following code works just fine for outputting links from an array. The next goal, is parsing the $thisPage variable from the URL (http://bushidodeep.com/contact.html/) so as <?php $thisPage=strtolower("contact");?>, this variable could also be assigned to the $links[] $key.

Moving to a dynamic link generator class, what PHP function(s) could be used to parse the URL?


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml";>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Generate Links</title>
<?php $thisPage=strtolower("contact"); ?>
</head>

<body>
<?php

$links=array("Home","Work","Contact");
$count =0;
echo "<ul id=\"navlist\"> \n";
foreach($links as $key){
        if(strtolower($key)!= $thisPage){
echo ("<li><a href=\"./$key\" tabindex=\"$count;\" title=\"link to $key\">$key</a></li>\n");
$count ++;
    }else{
echo ("<li id=\"current\">$key</li>");
   }
}
echo "</ul> \n";


/*prints key as tabindex......
$links=array("home","work","contact");
$count =0;
echo "<ul id=\"navlist\"> \n";
foreach($links as $key){
echo ("<li><a href=\"./$key\" tabindex=\"$count;\" title=\"link to $key\">$key</a></li>\n");
$count ++;
}
echo "</ul> \n";
*/

?>

<!--<a href="" tabindex="" title=""></a>-->

</body>
</html>

--- End Message ---
--- Begin Message ---
http://www.php.net/reserved.variables

use $_SERVER['PHP_SELF'] or $_SERVER['REQUEST_URI']

just parse its value to get what you needed.


hth,

John
On 5/17/07, CK <[EMAIL PROTECTED]> wrote:

Hi All,

The following code works just fine for outputting links from an
array. The next goal, is parsing the $thisPage variable from the URL
(http://bushidodeep.com/contact.html/) so as <?php
$thisPage=strtolower("contact");?>, this variable could also be
assigned to the $links[] $key.

Moving to a dynamic link generator class, what PHP function(s) could
be used to parse the URL?


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml";>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1" />
<title>Generate Links</title>
<?php $thisPage=strtolower("contact"); ?>
</head>

<body>
<?php

$links=array("Home","Work","Contact");
$count =0;
echo "<ul id=\"navlist\"> \n";
foreach($links as $key){
        if(strtolower($key)!= $thisPage){
echo ("<li><a href=\"./$key\" tabindex=\"$count;\" title=\"link to
$key\">$key</a></li>\n");
$count ++;
     }else{
echo ("<li id=\"current\">$key</li>");
    }
}
echo "</ul> \n";


/*prints key as tabindex......
$links=array("home","work","contact");
$count =0;
echo "<ul id=\"navlist\"> \n";
foreach($links as $key){
echo ("<li><a href=\"./$key\" tabindex=\"$count;\" title=\"link to
$key\">$key</a></li>\n");
$count ++;
}
echo "</ul> \n";
*/

?>

<!--<a href="" tabindex="" title=""></a>-->

</body>
</html>

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




--
GMail Rocks!!!

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

I would like to know if a SELECT SQL query list of records can be unsorted. 
SELECT statement retrieves a list of records from a certain table starting 
from record # 1 till record #N and when publishing the records, this is how 
it is presented, in a sequential way, is there any way to not present them 
in a sequential way ? e.g. if a user accesses a web page then he will see 
record #3 and then #7 and so on, another user accesses the same web page and 
he might see record #8 and then record#2..... etc

any experience on how to do this ?

Regards
Eduardo 

--- End Message ---

Reply via email to