php-general Digest 10 Sep 2007 06:35:51 -0000 Issue 5010

Topics (messages 261876 through 261891):

Re: Buxa Coding Guidelines
        261876 by: Per Jessen
        261877 by: brian
        261878 by: Jim Lucas
        261879 by: brian
        261891 by: Per Jessen

Re: Can't execute PHP script
        261880 by: Randy Patterson

accessing one object's attribute from another
        261881 by: Larry Brown
        261882 by: Robert Degen
        261884 by: Chris
        261885 by: Larry Brown

Re: Php script for mail in a xhtml page
        261883 by: Chris

Re: 403 Forbiden
        261886 by: Jesús de Diego Alarcón
        261887 by: Chris
        261889 by: Jesús de Diego Alarcón

display_errors = "stderr" Questions
        261888 by: imacat

Help with php and this part of the code...?
        261890 by: dekemcaffee

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 ---
brian wrote:

> Per Jessen wrote:
>> magoo wrote:
>> 
>>>In their oppinion stuff like the short PHP init "<?" or inline echo
>>>"<?= $var ?>" is forbidden.
>>>Do you people code that strict?
>> 
>> Yep.  If you're using XHTML you have no other option.
>> 
> 
> If you're parsing XHTML that is choking on any instances of "<%" then
> you've got a problem with your script. 

I'm not parsing it, apache does that.

An XHTML document will start with:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en">
<head>



/Per Jessen, Zürich

--- End Message ---
--- Begin Message ---
Per Jessen wrote:
brian wrote:


Per Jessen wrote:

magoo wrote:


In their oppinion stuff like the short PHP init "<?" or inline
echo "<?= $var ?>" is forbidden. Do you people code that
strict?

Yep.  If you're using XHTML you have no other option.


If you're parsing XHTML that is choking on any instances of "<%"
then you've got a problem with your script.


I'm not parsing it, apache does that.

Semantics

An XHTML document will start with:

<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.1//EN" "xhtml11.dtd"> <html
xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en">
 <head>


Uh-huh ... but then that's not a PHP script, is it?

To be more specific, something on the server that is meant to parse XHTML should not be encountering PHP syntax. If it does, then it is either wrongly attempting to parse a PHP script instead of XHTML, or your PHP script has syntax errors.

IOW, if you've got some PHP scripts that *output* XHTML, PHP shouldn't be leaving behind its own opening and closing tags. If it is (as i said earlier) you've got a problem with your script.

Or, perhaps what you mean is that the <?xml tag might be interpreted by PHP (as opposed to an XHTML parser misinterpreting PHP tags)? If that's the case, simply don't leave it bare in the script. Have PHP print it.

brian

--- End Message ---
--- Begin Message ---
brian wrote:
Or, perhaps what you mean is that the <?xml tag might be interpreted by PHP (as opposed to an XHTML parser misinterpreting PHP tags)? If that's the case, simply don't leave it bare in the script. Have PHP print it.

brian


Or, even better, turn off short_open_tag

Then PHP will not try and parse <?xml

--
Jim Lucas


    "Perseverance is not a long race;
        it is many short races one after the other"

Walter Elliot


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

Twelfth Night, Act II, Scene V
    by William Shakespeare

--- End Message ---
--- Begin Message ---
Jim Lucas wrote:
brian wrote:

Or, perhaps what you mean is that the <?xml tag might be interpreted by PHP (as opposed to an XHTML parser misinterpreting PHP tags)? If that's the case, simply don't leave it bare in the script. Have PHP print it.

brian


Or, even better, turn off short_open_tag

Then PHP will not try and parse <?xml


Well, that's circular logic, no?

Per: i obviously did misinterpret you. I thought you meant that SOME_XHTML_PARSER would choke on PHP tags. If so, perhaps my response will make sense to you now. But my point is still valid; one can just print out the <?xml with PHP. Being *one* line--and always in the same place--in every script, i don't see this as a very big deal at all.

I do agree that developing with short_open_tags = on is a Bad Idea if the app will not be under one's control.

IMO, the fact that the PHP engine barfs on <?xml with short_open_tags on is a bug that ought to have been fixed years ago. A space should be mandatory after the ?. Better yet, PHP should do away with <? ?> altogether but allow <?= ?>, which is *very* helpful (to those of us who choose to use it).

brian

--- End Message ---
--- Begin Message ---
brian wrote:

> Jim Lucas wrote:
>> 
>> Or, even better, turn off short_open_tag
>> Then PHP will not try and parse <?xml

Exactly. 

> Per: i obviously did misinterpret you. I thought you meant that
> SOME_XHTML_PARSER would choke on PHP tags. If so, perhaps my response
> will make sense to you now. But my point is still valid; one can just
> print out the <?xml with PHP. Being *one* line--and always in the same
> place--in every script, i don't see this as a very big deal at all.

It's a little backward, isn't it?  Certainly in comparison to just
turning off short tags, which we agree is the Right Thing(r) to do
anyway. 

> I do agree that developing with short_open_tags = on is a Bad Idea if
> the app will not be under one's control.

vtiger was one of those - at least in version 4, IIRC. Serious PITA.

> Better yet, PHP should do away with <? ?>
> altogether but allow <?= ?>, which is *very* helpful (to those of us
> who choose to use it).

I think it's fine for PHP to leave some of these as user options, but
the default should be to leave short_open_tag off (and have an
otherwise sane set of defaults).


/Per Jessen, Zürich

--- End Message ---
--- Begin Message ---
On Saturday 08 September 2007 16:15, Børge Holen wrote:
> as previously stated...
>
> give us the printout of:
> dpkg -l|grep apache
> dpkg -l|grep php
>
> On Saturday 08 September 2007 14:55, Randy Patterson wrote:
> > Hey,
> >
> > [Note:] This is a different problem from the one I posted earlier today.
> >
> > I can't get my LAMP server setup to run PHP script.
> >
> > As returned by apache2ctl, I am running;
> >
> > Apache/2.2.4 (Debian) PHP/5.2.3-1+b1
> >
> > I point my browser to;
> >
> > http://localhost/apache2-default/test.php
> >
> > The file test.php contains this code;
> >
> > <html><body>
> > <h1>PHP Test</h1>
> > <br />
> > <?php print "Hello World!"; ?>
> > </body></html>
> >
> > The browser outputs only;
> >
> > PHP Test
> >
> > But the script doesn't get executed. I posted this problem on
> > debian-users, [because I installed apache2/php5 via debian packages],
> > without any results. Thought I would try here before finding an apache
> > list. Although I have programed in PHP off and on for a while I am a
> > newbie to the setup side of things. Hopefully someone could point me in
> > the right direction to trouble shoot this.
> >
> > Thanks,
> > Randy

Here they are;

dpkg -l|grep apache
ii  apache2                           2.2.4-3                    Next 
generation, scalable, extendable web se
ii  apache2-doc                       2.2.4-3                    documentation 
for apache2
ii  apache2-mpm-prefork               2.2.4-3                    Traditional 
model for Apache HTTPD
ii  apache2-utils                     2.2.4-3                    utility 
programs for webservers
ii  apache2.2-common                  2.2.4-3                    Next 
generation   , scalable, extendable web se
ii  libapache2-mod-php5               5.2.3-1+b1                 server-side, 
HT   ML-embedded scripting languag

dpkg -l|grep php
ii  libapache2-mod-php5               5.2.3-1+b1                 server-side, 
HTML-embedded scripting languag
ii  php5                              5.2.3-1                    server-side, 
HTML-embedded scripting languag
ii  php5-common                       5.2.3-1+b1                 Common files 
for packages built from the php
ii  php5-mysql                        5.2.3-1+b1                 MySQL module 
for php5

Thanks,
Randy

--- End Message ---
--- Begin Message ---
Hi all, I've be developing with a structured approach for a long time
and am working at improving my site by adding some classes etc.  I
however, am running into an odd thing that I can't figure out what a
reasonable search syntax would yield the desired solution.  The problem
is as follows:

class a {

        var $thisVar;
        ...
}

class b {

        function hello()
        {
                echo $first->thisVar;
        }
}

$first = new a();
$first->thisVar = "world";

$second = new b();
$second->hello();


There are a number of variables and methods that are common throughout
the user's session that I'm storing in object $first.  Class b has
nothing in common with a except that it needs a couple of the variables
stored in the object that is hanging around in the session.

Is $first->thisVar the wrong way to reference that variable?  How can I
get to it?

TIA,

Larry

        

--- End Message ---
--- Begin Message ---
Perhaps I misunderstood the problem, but I would simply...

On So, Sep 09, 2007 at 10:06:15 -0400, Larry Brown wrote:
> Hi all, I've be developing with a structured approach for a long time
> and am working at improving my site by adding some classes etc.  I
> however, am running into an odd thing that I can't figure out what a
> reasonable search syntax would yield the desired solution.  The problem
> is as follows:
> 
> class a {
> 
        private $thisVar;

        public function getThisVar() {
                return $this->thisVar;
        }

        public function setThisVar($v) {
                $this->thisVar = $v;
        }

>       ...
> }
> 
> class b {
> 
>       function hello()
>       {


                echo $first->getThisVar();


>       }
> }
> 
> $first = new a();

$first->setThisVar("world");

> 
> $second = new b();
> $second->hello();
> 
> 
> There are a number of variables and methods that are common throughout
> the user's session that I'm storing in object $first.  Class b has
> nothing in common with a except that it needs a couple of the variables
> stored in the object that is hanging around in the session.
> 
> Is $first->thisVar the wrong way to reference that variable?  How can I
> get to it?
> 
> TIA,
> 
> Larry
> 
>       
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

-- 
Und komm, Du brauchst nur einen Baum
um 1000 Streichhölzer herzustellen.
Aber Du brauchst nur einen Streichholz
um 1000 Bäume abzubrennen.
Meine Güte wer soll das denn jetzt verstehen?
Ganz egal, komm wir bleiben noch etwas länger.
Die Bedeutung zahlt ja immer der Empfänger

--- End Message ---
--- Begin Message ---
Larry Brown wrote:
Hi all, I've be developing with a structured approach for a long time
and am working at improving my site by adding some classes etc.  I
however, am running into an odd thing that I can't figure out what a
reasonable search syntax would yield the desired solution.  The problem
is as follows:

class a {

        var $thisVar;
        ...
}

class b {

        function hello()
        {
                echo $first->thisVar;
        }
}

$first = new a();
$first->thisVar = "world";

$second = new b();
$second->hello();


There are a number of variables and methods that are common throughout
the user's session that I'm storing in object $first.  Class b has
nothing in common with a except that it needs a couple of the variables
stored in the object that is hanging around in the session.

Is $first->thisVar the wrong way to reference that variable?  How can I
get to it?

$first doesn't exist to $second - you need to make it so it knows what it is.

class b {
  var $first;
  function __construct($first) {
    $this->first = $first;
  }

  function hello() {
    echo $this->first->thisVar;
  }
}

then you:

$first = new a();
$second = new b($first);
$second->hello();

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

--- End Message ---
--- Begin Message ---
On Mon, 2007-09-10 at 12:45 +1000, Chris wrote:
> Larry Brown wrote:
> > Hi all, I've be developing with a structured approach for a long time
> > and am working at improving my site by adding some classes etc.  I
> > however, am running into an odd thing that I can't figure out what a
> > reasonable search syntax would yield the desired solution.  The problem
> > is as follows:
> > 
> > class a {
> > 
> >     var $thisVar;
> >     ...
> > }
> > 
> > class b {
> > 
> >     function hello()
> >     {
> >             echo $first->thisVar;
> >     }
> > }
> > 
> > $first = new a();
> > $first->thisVar = "world";
> > 
> > $second = new b();
> > $second->hello();
> > 
> > 
> > There are a number of variables and methods that are common throughout
> > the user's session that I'm storing in object $first.  Class b has
> > nothing in common with a except that it needs a couple of the variables
> > stored in the object that is hanging around in the session.
> > 
> > Is $first->thisVar the wrong way to reference that variable?  How can I
> > get to it?
> 
> $first doesn't exist to $second - you need to make it so it knows what 
> it is.
> 
> class b {
>    var $first;
>    function __construct($first) {
>      $this->first = $first;
>    }
> 
>    function hello() {
>      echo $this->first->thisVar;
>    }
> }
> 
> then you:
> 
> $first = new a();
> $second = new b($first);
> $second->hello();
> 
> -- 
> Postgresql & php tutorials
> http://www.designmagick.com/
> 

Thanks Chris and Robert, these both should work fine and was just what I
was looking for.

Larry 

--- End Message ---
--- Begin Message ---
brian wrote:
Mauro Sacchetto wrote:
I've to implement a php script in a web page to send mail.
If I use a .html form and a separate .php script, all works fine.
In the contrary, if I try to put the script into the .html file,
I've some troubles... Here's the code:

...

When I try to open the page, I receive this error:

Parse error: syntax error, unexpected T_STRING in /var/www/netsons.org/samiel/form2.php on line 79

Do u see my error?

{Copies, pastes into editor that will number the lines ...}

Well, looking in the vicinity of line 79, i'd say the problem lies with your reversed PHP tags:

<input name="name" size="50" maxlength="40" value=?> echo $name. <?">

You've got another right below that:

<input name="subject" size="50" maxlength="40" value="?>echo $subject;<?>

And another:

<textarea name="msg" cols="50" rows="8">?> echo $message;<?</textarea>

Some other points:

- You can do without the "echo" by using, eg. <?= $message ?>

Yet later in another thread you complain about short_tags being an option.. can't have it both ways.

Leave it as <?php echo $message; ?>

it's more portable - it will work on every single php server and you won't have any issues moving your code around.

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

--- End Message ---
--- Begin Message ---
Hello Brian

Thank you, but permisions are ok  (777).
Any other idea?
Thank you in advance

Jesús de Diego

> Hello all and thank you in advance.
> I'm totally beginer in PHP .
>
> I'm developing:
> http://www.my3dgis.es/visor/visor.htm#
>
> At Options > Herramientas > Búsqueda en Catastro  the application shows a
> form (ExtJS). In this form, the combobox Provincias should be loaded
using:
>
> http://www.my3dgis.es/visor/php/provincias.php
>
> However, using Firebug i can see that call to php/provincias.php always
> shows 403 (403 Forbidden).
>
> I don't know where the problem can be... this application is working ok
for
> me at localhost....
>

Check the permissions on php/provincias.php

brian

--- End Message ---
--- Begin Message ---
Jesús de Diego Alarcón wrote:
Hello Brian

Thank you, but permisions are ok  (777).

What about the permissions on the visor/php folder?
Can you access other files in that folder?

What about the permissions on the visor/ folder?
Can you access other files in that folder?

Do you have access to webserver error logs? It'll be a lot easier for you to debug this if you do.

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

--- End Message ---
--- Begin Message ---
Hello
I've noticed the problem is not well described:

1º There are some times the correct XML appears. However, these times, the
call in Firebug comes with "(403)" and highlihted in red color.

2º The others times, also appears (403) in the Firebug call , and as
response i get:
<HTML>
<HEAD>
<TITLE>403 Forbidden</TITLE>
</HEAD>
<BODY>
<H1>Forbidden</H1>
You do not have permission to access this document.
<P>
<HR>
<ADDRESS>
Web Server at my3dgis.es
</ADDRESS>
</BODY>
</HTML>
.....
.....

About permisions, visor directory has 755 also like php.
provincias.php has 777 permisions.

Thank you

Jesús de Diego



On 9/10/07, Jesús de Diego Alarcón < [EMAIL PROTECTED]> wrote:
>
> Hello Brian
> >
> > Thank you, but permisions are ok  (777).
> > Any other idea?
> > Thank you in advance
> >
> > Jesús de Diego
> >
> > > Hello all and thank you in advance.
> > > I'm totally beginer in PHP .
> > >
> > > I'm developing:
> > > http://www.my3dgis.es/visor/visor.htm#
> > >
> > > At Options > Herramientas > Búsqueda en Catastro  the application
> > shows a
> > > form (ExtJS). In this form, the combobox Provincias should be loaded
> > using:
> > >
> > > http://www.my3dgis.es/visor/php/provincias.php
> > >
> > > However, using Firebug i can see that call to php/provincias.php
> > always
> > > shows 403 (403 Forbidden).
> > >
> > > I don't know where the problem can be... this application is working
> > ok
> > for
> > > me at localhost....
> > >
> >
> > Check the permissions on php/provincias.php
> >
> > brian
> >
>
>
>
> --
> Visit: http://www.kingzones.org/

--- End Message ---
--- Begin Message ---
Dear all,

    Sorry if this is asked before.  I was checking the new
php.ini-recommended that comes with the newly-released PHP 5.2.4.  I
found a new option for the configuration directive display_errors:

display_errors = "stderr"

    and the comment says:

; stderr       - Display errors to STDERR (affects only CGI/CLI binaries!)

    So, I wonder what would happen with the Apache handler if I set
display_errors = "stderr"?  Should it act like On or Off?

    Also, I understand about CGI, but shouldn't all errors go to STDERR
for CLI?  Why should CLI errors go to STDOUT?

-- 
imacat ^_*'
[EMAIL PROTECTED]
PGP Key: http://www.imacat.idv.tw/me/pgpkey.asc

Tavern IMACAT's http://www.imacat.idv.tw/
Woman's Voice http://www.wov.idv.tw/
TLUG List Manager http://www.linux.org.tw/mailman/listinfo/tlug

Attachment: pgpwuRFrx8t4f.pgp
Description: PGP signature


--- End Message ---
--- Begin Message ---
Ok here is the code below, I need to know what I need to change in this code
for it to be able to be a clickable link... I have many layouts and want to
add more but with so many pages, its a bit hard to go through 49 pages just
to add one page. I already submitted this problem to 
http://www.webdesigningcompany.net web design company  but have yet to get
any solution. So here is the code.  I hope someone can help me!

http://<?php echo $img_url .  " alt="<?php echo $file; ?>" width="250" ><br>
<textarea name="textarea2" cols=23 rows=7 onClick="this.focus();this.sel...
"http://<?php echo $site_url; ? " target="_blank" title="<?php echo $urlpath
. $file; ?>">
http://<?php echo $img_url .  " border="0" alt="<?php echo $urlpath . $file;
?>">  
<?php if ($support_image != "") { ?>
"http://<?php echo $support_image; ? " alt="Myspace Editors"
style="position:absolute; left:0px; top: 0px;" border="0"> 
<?php } ?>
"http://<?php echo $site_url; ? /" target="_blank" title="Myspace
Images">This image is from <?php echo $site_name; ?> </center></textarea> 

-- 
View this message in context: 
http://www.nabble.com/Help-with-php-and-this-part-of-the-code...--tf4412308.html#a12586943
Sent from the PHP - General mailing list archive at Nabble.com.

--- End Message ---

Reply via email to