okay basically you use _GET variables The links would say yoururlcom-yourpagephpid=main and then in the table
get('link');
Any particular reason you prefer static methods?
TML for a registry? because there is no need to create an instance.
cyth, ill essentially be stealing that code for the registry from that article, and why do i omit the &?
php.net/references
using the static method it doesn't have to be passed either.
so you can be way out of scope and still access the objects
I duno if it's the best idea composition-wise, but it'd work.
inversion of control is one way of dealing with it - say you need a db object in your code. you have a 'db' member on the class that uses it. during setup you create a class, and assign a DB to it.
the idea is that now your class that does something can be tested in isolation - it has a dependency on a DB, but you can provide a mock DB or whatever in tests
so your code doesn't go find a DB, it has one provided to it.
I'd agree with that methodology
im so confused
there are a pile of java IoC tools but I don't know of any php ones
probably because writing a testing suite in php is an excersize in pain
An excersize?
excercise
yes, you can beat me over the head with websters now
You here?
we already know that of all the spelling errors you hate the most, i probably make 90% of them
that whole idea of 'where do i get my global objects' was always the sticking point for OO design for me until i ran across IOC
caffinated:
As long as you never type "suposably"
hay
Hello, I am using php includes for a menu that i'm using in tables. I have a thenu in one table row and When the person clicks the link I want the content to go to a different table row is that possible?
I'll get drunk this weekend and make an appearance. that should give you fodder for at least the next year.
I need php equivalent of java's String.indexOf()
strpos
Thanks
Not using just PHP it's not. You could either use some form of frame, or an AJAX call, to make the client do that.
If this week continues the way it started, I may just be gibbering mad by then, so I might not even notice
It's stunning how much slower Thunderbird 2.x paints itself than 1.5.x did.
I suspect the main cause is this silly two-color inbox listing they've moved to.
i feel you. my workload is ridiculous.
AND .. I was told I could get people to help, but I had to find them
happy day
do you want that content to be taken from an include file?
streetBUM, yes
I forgot how to do it
I did it once
didn't see anything… the swfupload has a debug window that shows me the files are actually uploaded, and the only php that happens is move_uploaded_files, that's where it seems to bug
oops sorry
frick
HAHA IM GOING TO BE SOOO RICH THAT I WILL BUY YOU ALL STUFF JUST FOR LAUGHS
hi
okay, basically you use $_GET variables. The links would say "yoururl.com/yourpage.php?id=main", and then in the table cell you would like your content to appear you need code like "PHP if $_GET['id'] == "main" { include(main.php); } ?
streetBUM, ok, I thought it was something like that I forgot thanks
No problem sn00p
i'll write that down
I got disconnected, did anyone see my pastebin link and my problem?
just don't do include $_GET['id']
correct, possible entry for cross-server scripting?
Do I need the return back slashes for the $query in the getConcertDays() function, or I can just go to the next line?
or include whatever file they want, basically
yeah
even include $_GET['foo'] . '.php'; does nothing for you
ok so i have my registry class stored in a separate file, why can't I require_once the separate file, do $instance = new Registry; and then global $instance and use that $instance within another class?
yeah, if you put all the includes into one folder and then strip slashes from the $_GET then it should be fine
only way to be fine is to not use request variable in your include path
you can, but at that point you're more or less doing exactly the same thing as global $mydbobj; - all your classes are dependent on the global variable named $instance
http://hashphp.org/pastebin.php?pid=25194 - can anyone tell me why the last line doesn't output anything?
Sorry, line 178*
total misuse of return;
Could you explain?
Haven't been into PHP for a while you see philip
you return one thing in a function
Ah only one?
and then the function returns the value, not the variable
Ok, if the line is too long, do I have to use '\' to be able to continue the statement on the new line, or it isn't necessary?
is there a way to override php.ini in may php script and turn warnings off?
okay. So how can i get around this??
not necessary
http://php.net/error_reporting
im pretty sure you can choos a specific PHP.ini file for a certain domain or folder?
Has anyone here ever used SWFupload (flash based upload for large files)? For some reason files that are bigger than 8 mb are not showing up and I'm wondering if php has anything to do with this, or if there's a way to debug it (it's not max_upload_filesize it's set at 100M)
Is it simply redundant, or it will generate an error?
error
try it, server won't blow up
thanks
just started looking into php again(haven't used it for some years)..this may be a stupid question, but are there many that uses the smarty template engine?
ok let me rephrase, is there a way to have a set function run when an instance is created? when an instance of the class "mysql" is created, I need it to create a new instance of the "Registry" class
I know, I just have a long statement to write and don't want to waste much time. I'm a bash guy, so kind of guys use to back slashes
is there a way for me to return those variables for use outside of the class? is that when I should use var();?
that's the constructor method
you _could_ use global statement
Xyphoid, ahh thats what it wasi knew it was something like that
why the _could_?
http://nz.php.net/manual/en/language.oop5.decon.php
generally people shy away from such things
people yell at me for using global
http://us.php.net/manual/en/language.variables.scope.php
it sounds a lot like a chicken and the egg type thing. mysql shouldn't be creating registry - registry should exsit before that
Was that for me in regard to global?
ok, thanks
nope, me
Sorry, got lost in a sea of intercrap there…Davey has duplicate addresses on purpose, I think.
why?
caffinated, my mind is bending right now let me think about that
POST Content-Length of 28674265 bytes exceeds the limit of 23068672 bytes in Unknown on line 0"
You've got me. He just asked me to add the gmail one this morning.
Maybe for archival?
with "error_reporting(0);"
think of it as creating the filing cabinet before writing the papers
that's why we have a group, so i don't know, i prefer people have just one (no real important reason)
if i removed those return(); lines and just put echo($GLOBALS['USD']); to test, would that be ok?
the purpose of the registry is to track objects you create and make it easy to access them from whatever scope. so, following that, if you need to register something like a mysql object, the registry needs to exist before you can register it.
nothing you do will blow up the server, so try whatever you want
experimenting is a form of learning
I've recently found that statement to be untrue.. but I'll give it a go !
granted, there are ways to create segfaults
but that doesn't quality as 'blow up'
caffinated, is it okay to just do an isset on $registry? it seems more convenient to me for some reason that if the registry instance isn't already created, to create it when constructing mysql
i figured they were all by accident
I think I'm a little confused about what you're trying to achieve - but isset() can be used with any variable to test it's existance. if that is the behaviour you want, then sure.
caffinated, its only because i use the mysql class a lot on several pages and would hate to have to remember to create a registry instance before creating mysql rather than just putting it in the constructor
using GLOBALS['EUR']; delivers nothing more, outside of the class. Instead, should I replace those return $VAR; lines with $EUR = global($EUR); ??
did you read that manual page?
do so, sloooowly
are you using the registry only for your database object?
I got that impression, that's why I thought I'd call that one item out: it was explicitly requested just this morning.
or do you have plans to use it for other things?
caffinated, yes, but to be safe, thats where isset comes in i think. if(!isset($registry) { $registry = new Registry(); } in the constructor
normally when i design an object, i start by writing the abstract for the top level - the part the programmer is going to use. the highest level. i abstract things out from there.
a database object is generally a low level piece
did you like the last line of that email? lol
caffinated, my only question about my method is that if say $registry is created elsewhere in another class, will $registry automatically have global status or after declaring the instance should i do global $registry; ?
ah thanks $GLOBALS[''] is a handy thing to use. But why is it frowned upon
why are globals frowned upon?
it will be in whatever scope you put it in - if it's in the global scope, and you try to access it outside of the global scope, then you will have to implicitly call the global scope.
that was me asking if you were asking that question
yes I am asking that question
how can something be outside of the global scope…
i think you're misunderstanding OO design though
you guys happen to know of any fedex soap examples?
because you end up losing track where you altered the variable, in the function? elsewhere? who knows
caffinated, i know at some point $registry has to be declared and i am having trouble figuring out where in my scripts (i have several php pages) that should take place
Ah okay, so nothing security-wise?
php has two scopes. the global scope, and the local scope. the local scope is anything in a function or method or class. the global scope is everywhere else.
sanity wise
Ah, that's all sweet then, thanks alot for the help!
loosing tract of variables doesnt help "secutiy"-wise
urgh
sickening
caffinated, i want $registry to technically be usable by all classes, so should i just make a habit of declaring it at the beginning of all my pages or something?
what are you talking about?
i'd be quite happy with class Main { public function __construct(){} } as an entry point, and do away with *all* globals
what you probably want is a factory class.
:O
a class responsible for creating new objects, putting them in the right place and performing any setup/teardown operations that need to happen
seemed to me that as long as something wasnt an explicit security issue its ok
dijkstra turning in his grave
but i think your main problem is that your design as it stands is flawed in the way you're thinking.
okay
when uploading files to a directory, i pass the directory in $_POST. But I lose the $_POST values if the file size being uploaded exceed post_max_size or upload_max_files_size
i think using a registry 'just to be good' is probably not worth it if you're just using it for db objects
you're seeing OO as a bunch of containers. you're trying to rope everything together instead of drawing object relationships.
any ideas on how to previent $_POST from getting wacked
put it in a witness protection program?
or is setting the directory in a cookie acceptable
it's ok if you have no idea what i'm talking about OO is not the easiest thing in the world to wrap your head around initially.
and people generally do it very wrong to start
to use objects properly you need a lot of practice with design patterns, well to think OOP you do
caffinated, yes clearly, the mention of that factory thing just made me realize I have like 9 separate class files that really should be in one