logs archiveIRC Archive / Freenode / #php / 2006 / March / 5 / 1
name
caffinated: hello?
caffinated
kuja: I've just realized, I have better things to do on a saturday than go over badly written code where I have to fight with the people I'm trying to help.
name
why doesn't that fu*king PHP remember the $_SESSION godammit :'( !
punkstar
as you speed up, relative time slows down.. right?
kuja
caffinated: 1) Enjoy Ruby, 2) Get laid... but I do both =)
itrebal
name i have a simple script for you: <?php session_start(); $_SESSION[
kuja
The mix quite well together.
itrebal
'test'] = 'w00t'; echo $_SESSION['test']; ?>
punkstar
kuja: multi task
         

itrebal
*thump thump tap tap thump thump tap*
caffinated
name: look at where you set $debug. then look at where you try to test the condition. then listen to me next time.
name
caffinated: what?
caffinated: $debug = "yes"; // Just change this variable if you know what you do.
caffinated
name: i asked you to add those two lines, not that stupid condition which won't ever succeed.
TML
kuja: You were going to tell me when adding a method on the object makes sense.
kuja
TML: And then I told you, that I was doing something totally wrong, and that you were correct after all. I'll have to get back to you on it :)
TML
:)
kuja
caffinated might know of a use, do you caffinated?!
name
caffinated: ok
caffinated: fixed ;)
ylon
I guess I'm going to have to give up on this one and ask for some deeper help, here's my code:
kuja
TML: I don't know about adding to an instance, but certainly being able to play around in the instance's scope is a handy "feature". Stuff like: class << self; return self; end <-- A metaclass of self.
ylon
http://pastebin.com/584130
I'm trying to set it up such that when someone comes to this particular page, if they've not been here before OR if they are coming from the wrong place it will send them to the correct place.
TML
kuja: I don't understand when you'd want to metaclass self.
^Artnez
ylon: what version of PHP are you on?
kuja
TML: Hold on, let me get words and no code.
ylon
^Artnez: 4.3.10
TML
ylon: It's almost certainly not the problem, but just as an FYI: Location technically has a capital L
name
caffinated: ideas?
^Artnez
ylon: use $_SERVER['HTTP_REFERER'], use isset( $_COOKIE['has_visited'] ) instead of just ($_COOKIE['has_visited'])
Sal
hello
         

^Artnez
ylon: also keep in mind that HTTP_REFERER wont be around sometimes... i think it happens when someone goes straight to the site
all i know is i've had undefined index error every once in a while
name
caffinated: ?
Sal
how can i format a number like this: 143.0 -> 143 but if its 143.3 has to remain 143.3
name
caffinated: what does this damn undefined index mean?
Sal
i just need to not show the decimal part if it's zero
kuja
TML: Considering that *everything* is an object. Everything belongs to something. In the end, Object is the grandfather. Metaclasses are useful because classes are objects. Yep, even the class definitions. Using a metaclass you can manipulate the class itself. A metclass will usually refer to the object's instance of Class. You can dynamically define methods for a class making sometimes your code more understable. For example, class Foo; define_these_methods
:foo, :bar, :baz; foo 1; bar 2; baz 3; end <-- Note that define_these_methods is pseudo stuff, but in the end it will define methods foo/bar/baz dynamically for that class.
name
what have i ruined?
^Artnez
Sal: how are you getting the number?
Sal
from mysql or it could by the sum of more mysql fields
name
caffinated: are u there?
kuja
TML: http://whytheluckystiff.net/articles/seeingMetaclassesClearly.html -- This guy makes it much more easier to see :)
PeterFA
I've decided that I'm going to start my own GNU project.
My trial code will be in PHP available for use and download off of my site (PHP source, that is)
Sal
^Artnez: any idea?
^Artnez
sal: hold
Sal
ok
kuja
TML: When you do class Foo; ...code...; end, you are equivalently doing Foo = Class.new; Foo.class_eval { ...code... }
PeterFA
I'm ganna' make a tax suite!!
name
caffinated: there?
kuja
This makes seeing classes much easier, because it's much more clear now that even class definitions are instances of something.
ylon
strange, it seems to work sometimes and sometimes not... going to have to test this some more
thanks much though for the help with that!
^Artnez
Sal: no clue.. i thought you could use something like sprintf() or number_format() but actually strippping the 0 at the end... dont know
Sal: you could of course just determine if there is a zero or not after the first decimal, then do an if/else .. but i'm sure there's a function out that there can let you do it right
ask another pro here :)
Sal
pro!! yoohoo!!
name
plz some1 help me: why did the $_SESSION stuff?
Stormchaser
!tell name about aolbonics
name
Stormchaser: common
Stormchaser: better help me
^Artnez
name: you really need to read through some tutorials. this isnt a free PHP course and we're not instructors
name
i did@
^Artnez
well read it again until you get it
name
how you think i did that damn code?
he?
kuja
TML: AFAIK, Python follows the class/attributes OO model. Where you design around your basic class structure. The difference with the Ruby Way is that you design your class. You design your class structure if that's what you want. Metaclasses may or may not be used (it all depends).
name
it's just that you don't know either ^Artnez
Sal
^Artnez: if(int(num) == num) { echo num; } else { echo number_format(num, 2); }
ops,
if(int(num) == num) { echo int(num); } else { echo number_format(num, 2); }
that should od it i think
^Artnez
Sal: use a ternary
Sal
?
whats that?
Stormchaser
php.net/ternary
Sal
oh, you mean the iif()
^Artnez
$num = ( int( $num ) == $num ) ? int( $num ) : number_format ... etc
name
i might just forget about the $SESSION
and add it later
Sal
ph.. didn't know that one
^Artnez
woops
Sal
:)
ok, thanks
^Artnez
$num = ( (int) $num == $num ) ? $num : numberformat( ... etc
DogWater
anyone see an issue here?
function send_prod($_POST["product"]) {
name
i got the bug, YESS!
DogWater: looks weird
DogWater: shouldn't it be function send_prod($1){
DogWater
isnt that the same thing?
name
and then call it with send_prod($_POST["product"])
DogWater
oh.
right
duh
Stormchaser
what the heck is $1?!?
^Artnez
lol
i'm sure you can't start a variable with an int
Stormchaser
of course you can't
flashbang
does anyone know why the DataObject implementation in zend framework was scrapped? or why it doesn't exist in the source?
Stormchaser
flashbang: Um... that's not ##php question
^Artnez
flashbang: the zend framework hasn't been released yet
airox
So it has been released.
flashbang
Stormchaser: sorry.. could you point me to the right channel for that?
airox
Ugh.
Stormchaser
flashbang: read the support page for that framework
levander
I'm working with the php sources, and they are doing 'parse_str($args, $r)', then evaluating the values in $r. They've got $r[children] being evaluated as a boolean, but I can't figure out what to set $args to to get $r[children] to be evaluated as FALSE. What I'm trying is $args='children=FALSE', doesn't seem to work.
working with the wordpress sources*
Stormchaser
Um... 'we don't support 3rd party scripts'?
levander
nevermind, finally damn found it, it's $args='children=', just don't set a value for children
Stormchaser: the famous #php snideness
flashbang
jesus.. what do you guys support?
levander
Stormchaser: wasn't a 3rd party script question
flashbang
it's all php..
Stormchaser
!+g10
php-bot
Guideline #10) We don't support xyz script. We help you *write* PHP, not download and install/hack/use pre-written scripts
levander
Stormchaser: you doing anything today? or just trying to tick off confused people on the internet?
^Artnez
(Action) does the ban dance
flashbang
Stormchaser: the channel topic even says "Zend Framework Released"
Stormchaser
(Action) grumbles at levander and flashbang
flashbang: Does that automatically means that we support it?
flashbang
jesus.. forget it
Gul
hi, anyone familiar with SOAP and HTTP_REQUEST in here? I have a problem finding out how to pass a new timeout value to my wsdl connection: $wsdl =& new SOAP_WSDL($this->wsdl_url); $this->client = $wsdl->getProxy();
is it possible to pass in timeout => 10 into SOAP_WSDL? i found out how to do it with SOAP_CLIENT, but I really need SOAP_WSDL
the title say Zend Framework 1.0 Released, somebody should probably change that to: Zend Framework 0.1.1 Released http://framework.zend.com/
GregVernon
well then...
TML
(Action) pokes at the soft underbelly of chanserv
DogWater
Anyone know if there is some special freakiness involved with caching form fields?
Jymmm
(Action) pokes at the soft underbelly of TML!
TML
oh, thanks chanserv
Jymmm
TML: See, you were suppose to be poking yourself!
Gul
i guess i am going to ask again in a minute, since this netsplit scrolled everything away
error403
fscking netsplits...
DogWater
TML wow this is a fun ride ;-)
TML
what a joke
DogWater
better than mr. toads' at disney
TML
DogWater: Are you saying that on your form you've done: '<input type="text" value="<?php echo $foo;?>" />'?
DogWater
well no I actually did echo "<input type=\"text\" value=\"$foo\" name=\"whatever\">$foo";
and the $foo in the textbox, and outside the textbox; are different. when I hit the back button
TML
DogWater: And when you view source, do it say value="number you think should be there"?
Because browser *do* cache input values, but I wouldn't expect such to override an explicit "value="
DogWater
<input type="text" name="qty" size="2" value="888">888
lol
but it says 1 888
in IE
TML
DogWater: Unexpected, but not *terribly* surprising.
DogWater
is there a best practices sorta thing for browser cache settings when it sorta matters?
usually I could really care less; but its kind of important that this works
« prev 1 2 3 4 5 6 7 8 9 10 11 12 13 14 next »