« first day (224 days earlier)      last day (4948 days later) » 

03:03
good morning
 
3 hours later…
05:46
good morning
hey friends I am getting error of
Warning: Cannot modify header information - headers already sent by (output started at /home/timeto/public_html/connect.php:6) in /home/timeto/public_html/login.php on line 9
any help?
06:16
@gms8994 just noticed you said 'iweartightpants' That's not your steam ID right? Cos I use that handle :D
ah, btw, that conversation is about 10 hours old ^_^
@Pankaj it says something echoed out before your header statment
even a white space can cause the problem
just before the <?php tag
check out nothing got echoed before your header call
06:45
@ShaktiSingh I have tried every thing but its allright on my local server but not working well with deployment server
07:01
<?php
error_reporting(0);
function goto($var){
  $switch=$var;
  break;
}
$switch='start';
switch($switch){
  case start:
    $i=0;
    echo "This is beginning of script\r\n";
  case this:
    echo "This should run\r\n";
    goto(loop);
  case infinity:
    echo "This shouldn't run\r\n";
  case loop:
    if($i<6){
      echo "The \$i equals $i.";
      $i++;
      goto(loop);
    }
    die;
  }
?>
OK, I can consider yourself bored
except it gives error
oh well - I should've use PHP6 instead of such silly tricks
oh wait, it was crashing because I was using PHP 5.3 which has "goto". lol
hello there, i need some help
What help you need, @baris22
This is my cats in mysql


cats_id cats_position cats_parentid

1 1> 0
2 1>2> 1
3 3> 0
4 1>2>4> 2
And?
i am new on the chat
07:11
But what is your problem?
how can i format my codes when writing down
Paste any code and press fixed font.
<?php
start:
goto start;
  echo 'notok';
?>
Like that
ok
i am trying to get my navigation work
so far i have done this
$pieces = explode(">", $position);

if ($pieces[0] != "")
{

$result = mysql_query("SELECT * FROM cats
WHERE cats_id='$pieces[0]'");
while($row = mysql_fetch_array($result))
{
$piecesid0 = $row['cats_id'];
$piecesname0 = $row['cats_name'];
$piecesposition0 = $row['cats_position'];
}
}
<a href="index.php">Index</a> >

<a href="cats.php?cat=<?=$piecesid0;?>&parent=0&position=<?=$piecesposition0;?>"><?=$piecesname0;?></a>
What is $position?
position is stored on table
cats_id cats_position cats_parentid

1 1> 0
2 1>2> 1
3 3> 0
4 1>2>4> 2
07:16
$position is variable. Do you load anything in it before?
yes. i get it from url
That is whole code?
like 1>2>
Let me guess? You're using code which was meant to be used with register_globals?
i include for breadcrumb
07:18
Try to use $_GET['position'] instead
$pieces = explode(">", $position);

if ($pieces[0] != "")
{

$result = mysql_query("SELECT * FROM cats
WHERE cats_id='$pieces[0]'");
while($row = mysql_fetch_array($result))
{
$piecesid0 = $row['cats_id'];
$piecesname0 = $row['cats_name'];
$piecesposition0 = $row['cats_position'];
}
}
if ($pieces[1] != "")
{
$result = mysql_query("SELECT * FROM cats
WHERE cats_id='$pieces[1]'");
while($row = mysql_fetch_array($result))
{
$piecesid1 = $row['cats_id'];
$piecesname1 = $row['cats_name'];
$piecesposition1 = $row['cats_position'];
Where is <?php at beginning?
Or at least <?
no there is no problem on getting the position
the problem is the way i have done is not professional
is there a better way to do this?
Try using foreach
for explode?
07:21
Also WHERE cats_id='$pieces[0]
Kinda weird in my opinion
<?php
$pieces = explode(">", $position);

$i=0;
 foreach($pieces as $piece){
 $result = mysql_query("SELECT * FROM cats
 WHERE cats_id='".$pieces[$i]."'");
 while($row = mysql_fetch_array($result))
 {
 $piecesid[$i] = $row['cats_id'];
 $piecesname[$i] = $row['cats_name'];
 $piecesposition[$i] = $row['cats_position'];
 }
 $i++
 }
 ?>
 <a href="index.php">Index</a>

 <?php $i=0; foreach($pieces as $piece){
 if($i=0)
  $parent=0;
 else
  $parent=$placesid[$i-1];
 echo '<a href="cats.php?cat='.$piecesid[$i].'&parent='.$parent'&position='.$piecesposition[$i].'>'.$piecesname[$i];
Something like this (not tested, so it may have bugs, or even have syntax error)
Good morning Folks
good day
@Zirak Rly? :|
Hello @Gmolvi
hi zirak
its my first time here and instead of posting question i came here to ask a small probelm i am having PHPDOM api
i have read a lot of SO answers and Google it as well but i think i am stuck in understanding how the whole DOM is working
if i have $doc = new DOMDocument()
then
ah sorry i 'll come back
Sorry, I'll be back in 1-2h
07:35
Thanks GlitchMr. i will try
08:13
yay
08:38
Hello again.
09:08
Hello @gordon
Is here anyone hood at Twig?
or any slimar Template Engine?
certainly not me. ask @edorian, he doesnt mind using template engines
Question is not complicated ;)
09:28
anyone ever played a game from the Call of Juarez series? Worthwhile?
I've played
It depends
Don't expect Call of Duty 6 :]
Wait a sec, you're talkin' about the new one?
any of the three
steam offers the third part for prepurchase and you get the second part for free
it looks interesting but since ive never played any of the series i cannot know
... free ... - always worth ;)
free when you invest 45 euro on the prepurchase
Check out some gameplays on YouTube.
09:39
yeah, will do. im also tempted to buy shogun2
 
2 hours later…
11:23
1
Q: purpose of constructor in php

user614208hello coders. I am newbie to OOP in php. I am doing a project in objects and class. where most of time I face a line public function __construct(){ } I can't understand this. Why its used and what is its value. Can some one tell me about it. I went to the php.net site but my doubt not clear...

I guess it's pointless to submit answer with this link because newbie wouldn't get it, but it can be interesting for you, guys...
11:38
@Gordon, @ircmaxell - I'd be happy to hear your opinions.
 
1 hour later…
12:41
It is good idea to create function that just returns (already existing) variable?
For example i have variable $template, and create function getTemplate() ?
13:06
@Robik each class usually has list of methods known as "getters" and "setters"
it is a bad style to expose objects internal variables directly
Well, it will be a function, not method
Like these WP's
what are "wp's" ?
@KamilTomšík Constructors should do logic. Any logic necessary to the operation of the object. Once the object is created, it should be usable. So if you need logic to do that, it belongs in the constructor. But then again, that's not "duck typing" :-P
@ircmaxell It wasn't about duck-typing at all... point was about constructors as non-oo "magic" thing with specific constraints (need for calling parent constructors, etc)
there's no need to call the parent constructor. You can if it fits, but you don't have to
13:27
Guys when using zend framework how do i determine if a class exists before trying to autoload it. I've got a function like this: getModel($ModelName) { return new Lib_Model_$ModelName; }
but if the model doesnt exist i want to throw an exception and not get a fatal error
any tips/solutions?
as in all of php, class_exists($class, false) (the false prevents autoloading)
@ircmaxell , constructor should not have any logic inside of it. Only the assignment operations. If you require some computation before or after creation of object for initialization of injection , then you should have a Factory for that
@ircmaxell no way? Really, Damn! thanks for the heads up
should have know that slaps head
@teresko well, depends on your definition of logic. Because I do consider assignment logic
@ircmaxell yes, in php, it's not so special - when I think about it, php has maybe one of the best constructor solutions. if error happens, instance won't be returned, it's still just a method so it does not have to be redeclared over and over again. Java on the other really sucks on this. (constructors has to be redeclared and they have to call super)
13:33
yeah
but it's not really a method. Which is what's weird about it
@ircmaxell I thought it is - you can call it, can't you?
if it's not, then there is the same problem as with Java - it's something special, which stinks... but at lest it does not stink so much.
@Andy try with class_exists('Lib_Model_Name_$ModelName', FALSE) to check if the class was already defined. Otherwise, file_exists to see if the file that class is supposed to be in exists. Other than that, it's a fatal error.
yay! third Necromancer badge!!
@gordon Why wouldnt i want to use Autoload? I currently have class_exists("Lib_Model_Name_$ModelName") and this works fine.
because autoload will try to autoload it, which i understood is not what you wanted to do?
@KamilTomšík it doesn't behave like one exactly...
13:41
ah, @ircmaxell already answered it anyways.. didnt see
I did?
12 mins ago, by ircmaxell
as in all of php, class_exists($class, false) (the false prevents autoloading)
@gordon Fair point, although atm without the false my exception is thrown i will also try with false see if the same occurs
@KamilTomšík It's not exactly a method, because if it was, a call to a non-existent __construct would trigger __call
FYI the example i gave above is similar but not the same as my problem
13:43
@Gordon Ahh, the question in here I thought you meant the question for the necromancer badge
@Andy why do you need this anyway? Just make sure you have a autoloader in place and be done with it. if the class cannot be autoloaded it cannot be autloaded
@Gordon TBH speed and laziness, i have this witin a servicelayer factory/auto loader of sorts.
define('FALSE', true); define('TRUE', false); /me just broke all of @Gordon's code
@Andy and who will ever catch that exception?
It's something i need to expand on and will probably extend/create the autoloader
13:45
@ircmaxell well, thx for explanation :)
@ircmaxell you are doing it wrong ;)
@Gordon but it works. You can't redefine the lowercase versions, but you can the uppercase...
@gordon I'm not sure i fully understand, but my error controller catches these exceptions
that might be but I find the uc version much easier to read. if someone wants to define true and false as constants, let him
@Gordon I find the lowercase easier to read. They are tokens, not constants. At least that's how I think of them...
13:47
i'm new to ZF so at times my methods might seem a bit mental to some of you veterans, i'm just conscious that i need to get my product "out the door" for the first iteration.
@Andy well, id say there is no point checking whether a class exists. if it exists it can be autoloaded. if it doesnt, it will raise a fatal anyway and script execution will end
@Gordon i've tried using class_exists with false set and my error controller doesnt catch the exception. With false it does
i hear you ( or rather read you ) on what you're saying i'd expect that behaviour too, but for some reason exceptions are thrown
what will it do when you dont check for class_exists at all?
where are the exceptions thrown from?
although i have just realied i've got my own set_error_handler
throws the fatal error o_0
but doenst get caught within the error_handler ... why might that be?
13:50
if it's a fatal error, it can't be caught
fatals cannot be caught with error handlers
i apprecaiate this is difficult to discuss without you seeing the application, but strangly with the class_exists i get my error controller without it i get fatal error and page dies
they can only be caught in the shutdown functions
yeah, it get what you mean now.
ah yes i recall reading something about that
i obviously want error controller
later
13:52
so all in all, it works beautifully for my needs right now.
you are doing if !class_exists('foo') then throw Exception() so you get a nice page
ah yes, that is correct.
@ircmaxell later
@Andy fair enough
@ircmaxell later
@gordon but in future creating an autoloader would be a better solution?
now you got me confused. I though that already was code from your autoloader
13:56
haha, it's a "factory" for my servicelayers, this way i can do new ServiceLayer_Factory::fetch("User");
and it will look where i tell it
i think it's similar to an autoloader and a factory. TBH i dont think it's a factory in the strictest sense
I see. Right on. Dont worry too much about the terms. If it works the way you did it, it works. Can still change it later
@Andy , static factory class is a black hole of dependencies
it causes a tight coupling all over your application
@teresko he's using ZF, so it doesnt matter much. one static call more or less
lol .. true
true static classes arent ideal, but for now, it works so that's good enough for me
14:12
Sorry, i had connection problems
no worries @Robik , no one missed you anyway
Well @teresko WP's == WordPress('s)
@teresko without any emote on that indicating j/k I find that rather rude to say
i didnt think that an emote was necessary for this one
its not like you can finish that sentence IRL with straight face
.. hmm ..
just saying someone could miss that is was likely meant humorous. wasnt flagged to be offensive so i might just be too sensitive. so no big thing. continue
14:22
@teresko @gordon @robik awkward turtle urbandictionary.com/define.php?term=awkward%20turtle
as demonstrated here: youtube.com/watch?v=9SULsR9-lbw
umm, yeah. id say now it has become really awkward ;D
likes how akward rhymes with aardvark
damn! Jon Skeet has four necromancer badges, too
14:51
What kind of SQL is that?
15:40
Anyone know if there will be SO API that allows to add questions?
 
1 hour later…
16:40
anyone on here know where i can get ZendX?
Is this an irc channel? If so what network is it on?
@udjamaflip this is not really an IRC channel
16:56
@Andy its in the full package in extras\library
@Gordon thanks. I'll check it out.
@udjamaflip If you'd like to mess with SO chat using IRC.
17:37
What is the most recent version of ZF? I thought it was 1.11.7?
it seems to be 1.11.6 have i missed something somewhere?
@Andy 1.11.6 was just released the 5th of May.
hmmm, why did i think it was 1.11.7 then, strange no?
i must've been using 1.11.4 or something.
ah well, no drama i suppose
17:57
For those of you still ehre, i've just changed all my libraries and i've moved Frameworks/Zend/Application to Frameworks/Zend/1.11.6/Application
the issue is, all my requires now fail as they're expecting Zend/Application and not Zend/1.11.6/Application how do i fix this?
Do i have to reorg them again to be 1.11.7/Zend/Application
basically a little lost and unsure what how to fix
( sorry if that's clear as mud )
Hmm, you could create define (like ZF_PATH) :P
ok solved the problem myself, i need to chnage my library structure from

Library/Zend/1.11.7/Acl

to

library/ZendFramework/1.11.7/Zend/Acl
that way i can set the includes as expected and not have to f. around within everything else
And you would have to change define value, not in each require
yeah
[ obviously i mean 1.11.6 and not 1.11.7 ]
Jez
Jez
18:24
hello
Hi @Jez

« first day (224 days earlier)      last day (4948 days later) »