php-general Digest 8 Oct 2007 13:59:43 -0000 Issue 5061
Topics (messages 262898 through 262901):
Re: Beginner Tutorials for using CLASSES in PHP4
262898 by: Robert Cummings
Re: Handling profile view counters
262899 by: Chris
Re: error messages
262900 by: tbt
problem with download script on safari and ie 7
262901 by: Hulf
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 ---
On Sun, 2007-10-07 at 11:42 +0100, Tony Marston wrote:
>
> The definition of OOP is "programming which is oriented around objects, thus
> taking advantage of Encapsulation, Polymorphism, and Inheritance to increase
> code reuse and decrease code maintenance". It is possible to do this in PHP
> 4 without all the fancy add-ons which appeared in PHP 5. How do I know?
> Because I have written an entire framework using objects in PHP 4, and the
> result is high code reuse and low maintainence. There are no additional OO
> features in PHP 5 which could deliver any measurable improvements.
>
> > any oo php4 'program' is inherently
> > weak for the reasons i have sighted, namely the implementation can be
> > latched onto producing tightly coupled code.
>
> Coupling is the degree of interaction between two modules. Low levels of
> coupling tend to create code which is more reusable, whereas high levels of
> coupling tend to create code which is less reusable. Coupling is therefore
> directly related to reusability. Making all variables private does not *in
> itself* make the code more reusable, therefore it does not make the code
> more "coupled" or less "coupled".
Well, Nathan is assuming that if you have a public member that you
probably didn't provide get/set wrappers for it. As such directly using
the member variable does indeed increase the couple of your code to that
module because if the variable needs to change in some way it's not
possible to change the behaviour across the board without updating all
uses of the member variable.
However, just because it's public doesn't mean it doesn't have a get/set
wrapper and doesn't mean it should be used directly. Yes, using a
private declaration enforces use of the get/set wrapper, but once again,
documentation can make this point also and as such marking a member
variable as private is just syntactic sugar.
Strangely enough though, PHP5 provides the means to NOT provide get/set
methods and still modify the behaviour of direct access to a member
variable via the magic __get/__set methods. Therefore the coupling issue
is pretty moot for PHP5 regardless of how the variable is accessed.
Cheers,
Rob.
--
...........................................................
SwarmBuy.com - http://www.swarmbuy.com
Leveraging the buying power of the masses!
...........................................................
--- End Message ---
--- Begin Message ---
Steve Finkelstein wrote:
Hi all,
I'm contemplating on a proper way of handling a counter for profile
views on my auto dealership website. I'm currently confused with the
type of algorithm to approach this with.
Say a user has a registered session, and views profile a). I can
increment the counter for that vehicle. The user can then surf
vehicles b,c,d....N etc and I'll increment the counter. However, if
the same session tries to visit profile a,b,c,d should I not increment
the counter? How would you all do it?
Depends on what stats you want to see. If you want to see info
per-session then ignore duplicates. If you want to see info for
everything, don't ignore duplicates.
Alternatively store everything - duplicates and uniques and depending
what you want to see you have both.
--
Postgresql & php tutorials
http://www.designmagick.com/
--- End Message ---
--- Begin Message ---
Yes i was looking for view parse errors on my browser but now I guess will
have to use an IDE Like zend :)
tedd wrote:
>
> At 10:27 PM +0200 10/5/07, Zoltán Németh wrote:
>>2007. 10. 5, péntek keltezéssel 12.57-kor tedd ezt írta:
>>
>> > I long for the time where my editor said "Offending syntax on line
>> 236".
>>
>>my editor still says "parse error" and shows me the line number... ;)
>>
>>greets
>>Zoltán Németh
>
> Consider yourself lucky, or me unfortunate. :-)
>
> All my development is spent online -- the browser god is not forgiving.
>
> One of these days I'll get the Zend IDE to work.
>
> Cheers,
>
> tedd
>
> --
> -------
> http://sperling.com http://ancientstones.com http://earthstones.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
--
View this message in context:
http://www.nabble.com/error-messages-tf4573258.html#a13090113
Sent from the PHP - General mailing list archive at Nabble.com.
--- End Message ---
--- Begin Message ---
The problem I am getting is safari just downloads the .php file. IE7
corrupts the binary file. It opens fine on FF and IE6. Is this a headers
problem?
Thanks,
R.
<?php
if(isset($_GET['id']))
{
$id = $_GET['id'];
$query = "SELECT file_name, type, size, content FROM results WHERE id =
'$id'";
$result = mysql_query($query) or die(mysql_error());;
list($file_name, $type, $size, $content) =
mysql_fetch_array($result);
/*echo $file_name;
echo $type;
echo $size;*/
header("Content-Type: $type");
header("Content-Disposition: attachment; filename=$file_name");
header("Content-Length: ".filesize($file));
header("Accept-Ranges: bytes");
header("Pragma: no-cache");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-transfer-encoding: binary");
echo $content;
exit;
--- End Message ---